Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- int RECV_PIN = 11;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup()
- {
- Serial.begin(9600);
- // In case the interrupt driver crashes on setup, give a clue
- // to the user what's going on.
- Serial.println("Enabling IRin");
- irrecv.enableIRIn(); // Start the receiver
- Serial.println("Enabled IRin");
- }
- unsigned int last_read = 0;
- int last_index = 0;
- int readed[10];
- void loop() {
- if (irrecv.decode(&results)) {
- if(millis()-last_read > 1000){
- last_index = 0;
- }
- else{
- last_index++;
- }
- readed[last_index] = results.value;
- last_read = millis();
- irrecv.resume(); // Receive the next value
- }
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement