You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void setup() { Serial.begin(115200);
while (!Serial);
Serial.print("\n"); Serial.println("dbg> ESP32 Test program. Start ...");
SerialBT.register_callback (Bt_Status);
Serial.println("The device started, now you can pair it with bluetooth!"); if(!SerialBT.begin("ESP32")){
Serial.println("An error occurred initializing Bluetooth"); }else{ Serial.println("Bluetooth initialized. Bluetooth Started!"); Serial.println("Bluetooth device name(ESP32), Ready to pair..."); } }
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
bool isconnected = false;
void Bt_Status (esp_spp_cb_event_t event, esp_spp_cb_param_t *param) { if (event == ESP_SPP_SRV_OPEN_EVT) { Serial.println ("Bluetooth: Connected"); isconnected = true; } else if (event == ESP_SPP_CLOSE_EVT ) { Serial.println ("Bluetooth: Disconnected"); isconnected = false; } }
void setup() { Serial.begin(115200);
while (!Serial);
Serial.print("\n"); Serial.println("dbg> ESP32 Test program. Start ...");
SerialBT.register_callback (Bt_Status);
Serial.println("The device started, now you can pair it with bluetooth!"); if(!SerialBT.begin("ESP32")){
Serial.println("An error occurred initializing Bluetooth"); }else{ Serial.println("Bluetooth initialized. Bluetooth Started!"); Serial.println("Bluetooth device name(ESP32), Ready to pair..."); } }
void loop() {
if (Serial.available()){
char command = Serial.read();
Serial.print("Recived command : "); Serial.print(command); Serial.print(", ");
if(command == '3'){
Serial.println("REQ#3:");
cmd_tx_result_data1(); //test1: make string & TX data: swing raw data, bluetooth
} else{
Serial.println("Wrong command(3)");
Serial.println("Usage: ");
Serial.println(" REQ#3: make string & TX data"); }
}
}
void cmd_tx_result_data1() {
String tx_data1 = "here is some format code";
if (isconnected) {
Serial.print("dbg> tx_data1 = "); Serial.println(tx_data1); SerialBT.print(tx_data1);
} else { Serial.println ("dbg> Bluetooth: Client Not Connected"); }
}
i need to receive data from above esp32 code at ios app coded by swift or swiftUI
but i failed...
i found this "react-native-bluetooth-serial" project.
can i receive data from above esp32 code using "react-native-bluetooth-serial" program ?
The text was updated successfully, but these errors were encountered: