Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
- * An IR LED must be connected to Arduino PWM pin 3.
- * Version 0.1 July, 2009
- * Copyright 2009 Ken Shirriff
- * http://arcfn.com
- */
- #include <IRremote.h>
- IRsend irsend;
- void setup()
- {
- pinMode(4, OUTPUT); //set 4 and 5 to high/low so the IR led can run right off the board
- pinMode(5, OUTPUT);
- digitalWrite(4, HIGH);
- digitalWrite(5, LOW);
- pinMode(12, OUTPUT); // Set 12 and 13 to high/low so the IR led can run right off the board
- pinMode(13, OUTPUT);
- digitalWrite(12, 1);
- digitalWrite(13, 0);
- pinMode(8, INPUT);
- pinMode(9, INPUT);
- }
- void loop() {
- while (digitalRead(9) == HIGH) {
- if (digitalRead(8) == HIGH) {
- for (int i = 0;i < 20; i++) {
- irsend.sendSAMSUNG(0xE0E040BF, 32); //POWER, SAMSUNG TV
- delay(40);
- }
- } else if (digitalRead(8) == LOW) {
- for (int i = 0;i < 20; i++) {
- irsend.sendNEC(0x80E0043A, 32); //TURN AIR OFF
- delay(40);
- }
- }
- delay(1000); //5 second delay between each signal burst
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment