#include #include SoftwareSerial BTSerial(10, 11); // RX, TX for Bluetooth Servo myServo; // Servo object char command; // Variable to store Bluetooth data void setup() { Serial.begin(9600); // Serial Monitor for debugging BTSerial.begin(9600); // Bluetooth communication myServo.attach(9); // Servo connected to Pin 9 myServo.write(90); // Start at neutral position (90°) Serial.println("Bluetooth Ready! Send 'L' for Left, 'R' for Right."); } void loop() { if (BTSerial.available()) { command = BTSerial.read(); Serial.print("Received: "); Serial.println(command); // Control servo based on Bluetooth input if (command == 'L') { myServo.write(0); // Move Servo to 0° (Left) Serial.println("Servo Moved Left"); } else if (command == 'R') { myServo.write(180); // Move Servo to 180° (Right) Serial.println("Servo Moved Right"); } } }