Created
March 5, 2023 11:30
-
-
Save dj1711572002/f43cdc3c9fc2b4cada63bdea2700270e to your computer and use it in GitHub Desktop.
ESP32E BlueTooth SPP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BluetoothSerial SerialBT; | |
uint64_t chipid; | |
char chipname[256]; | |
void setup() { | |
Serial.begin(115200); | |
chipid = ESP.getEfuseMac(); | |
sprintf( chipname, "ESP32EA0_%04X", (uint16_t)(chipid >> 32)); | |
SerialBT.begin(chipname); | |
Serial.print("BT chipname:"); | |
Serial.println(chipname); | |
} | |
void loop() { | |
if(Serial.available()>0) | |
{ | |
char cdata= Serial.read(); | |
SerialBT.print(cdata); | |
//Serial.print(cdata); | |
} | |
if (SerialBT.available()) { | |
char rdata=SerialBT.read(); | |
Serial.print(rdata); | |
//Serial.print(rdata); | |
} | |
//delay(20); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment