Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- int RECV_PIN = 3;
- int RELAY_PIN = 13;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- int An = 0;
- bool debug = false;
- void setup(){
- pinMode(RELAY_PIN, OUTPUT);
- pinMode(13, OUTPUT);
- pinMode(10, OUTPUT);
- pinMode(7, OUTPUT);
- Serial.begin(9600);
- irrecv.enableIRIn(); // Start the receiver
- }
- void loop() {
- if (irrecv.decode(&results)) {
- long value = results.value;
- Serial.println(value, HEX);
- irrecv.resume(); // Receive the next value
- }
- if ( Serial.available() > 0 ){
- int state = Serial.read();
- if ( state == 1 ){
- blink(13, 100);
- }else if ( state == 2 ){
- blink(7, 100);
- }else if ( state == 10 ){
- blink(10, 1000);
- }
- }
- }
- void blink(int pin, long timeout){
- digitalWrite(pin, HIGH);
- delay(timeout);
- digitalWrite(pin, LOW);
- }
Add Comment
Please, Sign In to add comment