Skip to content

Instantly share code, notes, and snippets.

@dj1711572002
Created March 5, 2023 11:30
Show Gist options
  • Save dj1711572002/f43cdc3c9fc2b4cada63bdea2700270e to your computer and use it in GitHub Desktop.
Save dj1711572002/f43cdc3c9fc2b4cada63bdea2700270e to your computer and use it in GitHub Desktop.
ESP32E BlueTooth SPP
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