#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
const int ledPin=2;
void setup() {
// put your setup code here, to run once:
SerialBT.begin("ESP32-Bluetooth20250402Β");
pinMode(ledPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(SerialBT.available()) {
char c=SerialBT.read();
if(c=='1'){
digitalWrite(ledPin,1);
} else if (c=='0') {
digitalWrite(ledPin,0);
}
}
}
Σχόλια
Δημοσίευση σχολίου