#include #include #define IR_PIN 26 // Pin connected to IR receiver #define SERVO_PIN 6 // Pin connected to servo motor IRrecv irrecv(IR_PIN); decode_results results; Servo servo; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the IR receiver servo.attach(SERVO_PIN); // Attach servo to pin 6 servo.write(0); } void loop() { if (irrecv.decode(&results)) { unsigned long hexValueRead = results.value; Serial.println(hexValueRead); delay(1000); if (results.value == 553536955) { // Check if received code matches the expected code // Rotate servo motor to a specific angle (e.g., 90 degrees) servo.write(180); // Adjust angle as needed delay(500); Serial.println("Servo rotated to 90 degrees."); _ } if (results.value == 1386468383) { // Check if received code matches the expected code // Rotate servo motor to a specific angle (e.g., 90 degrees) servo.write(0); // Adjust angle as needed delay(500); Serial.println("Servo rotated to 90 degrees."); } irrecv.resume(); // Receive the next IR signal } }