Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //RX
- #include "BluetoothSerial.h"
- #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
- #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
- #endif
- BluetoothSerial SerialBT;
- void setup() {
- Serial.begin(115200);
- SerialBT.begin("ESP32test"); //Bluetooth device name
- Serial.println("The device started, now you can pair it with bluetooth!");
- }
- void loop() {
- uint8_t recv_data[6];
- if (SerialBT.available()) {
- SerialBT.readBytes(recv_data, 6);
- //Serial.printf("%c %c %c %c %c %c", recv_data[0], recv_data[1], recv_data[2], recv_data[3], recv_data[4], recv_data[5]);
- Serial.println((char*)recv_data);
- Serial.println();
- }
- delay(20);
- }
Advertisement
Add Comment
Please, Sign In to add comment