前言
有同学可能已经注意到了,在我的github中参杂着一些c++的github
这些就是esp32做的内容
开始
这里有三个文件:
请参照blueprint图纸(all chinese).pdf
搭建
其中serial test tool串口调试器
的使用参见另一篇文章
上传sketch_car.ino
是会有以下问题 ,请点击OK
后上传,此处使用DOIT ESP32 DEVKIT V1
上传,需要安装驱动并将espressif解压并将文件夹移动到<arduino安装路径>/Contents/Java/hardware
路径下(这里是mac版本,windows用户猛戳这里)
完成后使用串口调试器发送udlrs
即可
代码分析
初始化:
#include <BluetoothSerial.h>
#include "ssd1306.h"
#include "ssd1306_console.h"
Ssd1306Console console;
int readleft = 0;
int readright = 0;
long leftnum = 0;
long rightnum = 0;
BluetoothSerial SerialBT;
void setup() {
ssd1306_128x64_i2c_init();
ssd1306_clearScreen();
ssd1306_setFixedFont(ssd1306xled_font6x8);
ledcSetup(0, 5000, 10);
ledcSetup(1, 5000, 10);
ledcSetup(2,<