-
-
Save netmaniac/6ea09dc182f2ebe18ea773b7952c3126 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremote.h> | |
#define IRRECV 11 // Numer pinu odbiornika IR | |
#define RELAY 8 // Numer pinu przekaźnika | |
IRrecv irrecv(IRRECV); | |
void setup() { | |
irrecv.enableIRIn(); | |
pinMode(RELAY, OUTPUT); | |
} | |
void loop() { | |
unsigned long code = readIRCode(); | |
if(code == 0xFFA25D) { // CH_MINUS | |
digitalWrite(RELAY, LOW); | |
} | |
if(code == 0xFFE21D) { // CH_PLUS | |
digitalWrite(RELAY, HIGH); | |
} | |
} | |
unsigned long readIRCode() { | |
decode_results results; | |
unsigned long resultValue = results.value; | |
irrecv.resume(); | |
return resultValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment