/* IR remitter project * Tutorial and circuit graph url: http://osoyoo.com/?p=572 * this project should work with IR receiver project together URL: http://osoyoo.com/?p=558 * Before running this code, you should install IRremote library, download link http://osoyoo.com/wp-content/uploads/samplecode/IRremote.zip * after pushing the switch in remitter circuit, the LED in receiver circuit will turn on, push * push the switch again, the LED will turn off */ #include IRsend irsend; const int buttonPin = 4; // the number of the pushbutton pin int buttonState = 0; // variable for reading the pushbutton status void setup() { pinMode(buttonPin, INPUT); Serial.begin(9600); } void loop() { buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: irsend.sendNEC(0x80BFA15E, 32); } }