diff --git a/README.md b/README.md new file mode 100644 index 0000000..71b49a7 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# ESP32 TB6612 麦轮车 + +## 特性 + +- ESP32 主控 +- 四路 TB6612 电机驱动 +- 麦轮车 +- BLE 串口通信 +- 循迹功能 +- 手动控制 + +## 原理图 + +![原理图](./docs/原理图.png) + +## 使用 + +### VSCode 安装 PlatformIO + +### 下载项目 + +```bash +git clone https://github.com/colour93/esp32-car.git +``` + +## BLE 串口通信协议 + +[数据包格式](./packet.md) \ No newline at end of file diff --git a/docs/原理图.png b/docs/原理图.png new file mode 100644 index 0000000..86bfecd Binary files /dev/null and b/docs/原理图.png differ diff --git a/packet.md b/packet.md index 548160b..aab21e3 100644 --- a/packet.md +++ b/packet.md @@ -61,4 +61,14 @@ 包体 `00 06 21 方向 时间 FF` -控制示例 `00 06 21 01 01 FF` \ No newline at end of file +控制示例 `00 06 21 01 01 FF` + +## 设置 + +### 设置转向灵敏度 `0x30` + +含义为 1 度对应差速 + +包体 `00 05 30 差速 FF` + +设置示例 `00 05 30 10 FF` diff --git a/src/main.cpp b/src/main.cpp index 9b176df..7cf1293 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,8 @@ #define STATUS_LED 2 +#define DEVICE_NAME "WhiteTiger" + #define HC_SR04_TRIG 23 #define HC_SR04_ECHO 22 @@ -165,7 +167,7 @@ void setup() Serial.begin(115200); // 初始化 BLE - BLEDevice::init("WhiteTiger"); + BLEDevice::init(DEVICE_NAME); pServer = BLEDevice::createServer(); pServer->setCallbacks(new CarBLEServerCallbacks());