一、硬件
ESP32
白色LED
超声波传感器
USB转串口(只用到VCC,GND)
面包板
二、软件
Arduino IDE版ESP32开发板
Blinker,apk
三、电路连接
USB转串口(LED) VCC(VCC) GND(GND)(ESP32的GND
ESP32:LED:超声波传感器
VCC: :VCC GND:GND:GND
25: :trig
15: :echo
12:LED in:
四、代码
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
#include<Wire.h>
#include<NewPing.h>
#define BLINKER_BLE
#include <Blinker.h>
int r=0;
int g=0;
const int TRIGGER_PIN = 25;
const int ECHO_PIN = 15;
#define MAX_DISTANCE 400
int led=0;
const int LED=12;
char state1[]="on";
char state2[]="off";
void TaskBlink( void *pvParameter