USB-TTL/USB-STC-ISP driver setup

Esp32 Bluetooth code . HIGH/LOW



 


                     Esp32  Bluetooth  code . HIGH/LOW   

Code :-   

C++
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
char receivedChar;// received value will be stored as CHAR in this variable
int LEDpin = 2;

void setup() {
  Serial.begin(115200);
  SerialBT.begin("ESP32_sr&ex"); //Bluetooth device name
  pinMode(LEDpin, OUTPUT);
 }
void loop() {
    receivedChar =(char)SerialBT.read();
 
  if (Serial.available()) {
    SerialBT.write(Serial.read());
  }
 if(receivedChar == 'a')
    {
    digitalWrite(LEDpin, HIGH);// turn the LED ON
    }
     if(receivedChar == 'b')
    {
    digitalWrite(LEDpin, LOW);// turn the LED off 
    }    
    delay(20);
   }

More  Details in video :-______________


Comments