#include < SoftwareSerial.h > const int ledPin = 0; // GPIO pin for the LED SoftwareSerial bluetoothSerial(3, 4); // RX, TX pins for HC-05 void setup() { Serial.begin(9600); // Initialize the serial communication for debugging bluetoothSerial.begin(9600); // Initialize Bluetooth serial communication pinMode(ledPin, OUTPUT); // Set the LED pin as an output } void loop() { if (bluetoothSerial.available() > 0) { char command = bluetoothSerial.read(); // Toggle LED based on received command if (command == '1') { digitalWrite(ledPin, HIGH); // Turn on LED Serial.println("LED ON"); } else if (command == '0') { digitalWrite(ledPin, LOW); // Turn off LED Serial.println("LED OFF"); } } }