View difference between Paste ID: 9C58e0q9 and 6SJKtPzx
SHOW: | | - or go back to the newest paste.
1
BluetoothSerial bluetoothSerial;
2
3
Serial.println("Initializing Bluetooth...");
4
if(!bluetoothSerial.begin("ESP32", true)) {
5
    Serial.println("Error initializing Bluetooth");
6
} else {
7
    //bluetoothSerial.enableSSP();
8
    bluetoothSerial.onConfirmRequest([](uint32_t num_val){
9
        Serial.println("BT Confirm Request");
10
    });
11
    bluetoothSerial.onData([](const uint8_t *buffer, size_t size){
12
        Serial.println("BT Data");
13
    });
14
    bluetoothSerial.onAuthComplete([](boolean success){
15
        Serial.println("BT AuthComplete");
16
    });
17
    bluetoothSerial.setPin("1234");
18
}
19
20
... in loop():
21
if(bluetoothSerial.available()) {
22
    Serial.write(bluetoothSerial.read());
23
}