Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- const int BUTTON = 5;
- const int POWER_DIODE = 6;
- //IR PIN - 4 RESERVED
- IRsend irsend;
- const int EMPTY=600;
- const int ZER=600;
- const int ONE=1200;
- const int HEADER=2400;
- void setup()
- {
- digitalWrite(POWER_DIODE, HIGH);
- }
- //0x83 – 0х0C
- void loop() {
- if(digitalRead(BUTTON) == HIGH)
- {
- int khz = 56; // 38kHz carrier frequency for the NEC protocol
- unsigned int irSignal[] = {HEADER, EMPTY,
- ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ONE,EMPTY,ONE,EMPTY,
- ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY,ONE,EMPTY,ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,
- ONE,EMPTY,ONE,EMPTY,ONE,EMPTY,ZER,EMPTY,ONE,EMPTY,ZER,EMPTY,ZER,EMPTY,ZER,EMPTY};
- irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.
- }
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement