April 13, 2026
Description
Arduino Micro, Ir Remote. Replace the Hex Values in the code with your own ir remote button codes.
CODE:
#include <IRremote.hpp>
#include <Servo.h>
#define IR_RECEIVE_PIN 2
Servo myServo;
void setup() {
Serial.begin(9600);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
myServo.attach(9); // Servo on pin 9
}
void loop() {
if (IrReceiver.decode()) {
unsigned long code = IrReceiver.decodedIRData.decodedRawData;
Serial.println(code, HEX);
if (code == 0xE916FF00) {
myServo.write(30);
}
else if (code == 0xF30CFF00) {
myServo.write(120);
}
IrReceiver.resume();
}
}
License:
BY-NC-SA