Internet Of Things

White this may be a post better suited for the Arduino Community or StackOverflow I wanted to jump in as I was able to set this up relatively easily. FWIW the code you have there is for passing data to firebase which could then be fed into a Thunkable app! :slight_smile:

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
const byte ledG = 33;


#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"

class MyCallbacks: public BLECharacteristicCallbacks {
    void onWrite(BLECharacteristic *pCharacteristic) {
      std::string value = pCharacteristic->getValue();
      
      if (value == "0") {

        digitalWrite(ledG, HIGH);

      }
      else {
        digitalWrite(ledG, LOW);
      }
    }
};


void setup() {
  Serial.begin(115200);
  pinMode(ledG, OUTPUT);
  BLEDevice::init("Thunkable & esp32");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );

  pCharacteristic->setCallbacks(new MyCallbacks());
  pCharacteristic->setValue("Turn me on/off");
  pService->start();

  BLEAdvertising *pAdvertising = pServer->getAdvertising();
  pAdvertising->start();
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
 
}


**that’s a 220 Ω resistor and an esp32 nodeMCU unit

I just reread this and am wondering if I misunderstood. Do you want to control the device from data you are sending to firebase from a thunkable app?