Commit c2725043 by satsob

IR Sensor

parent 2f0a6a47
Showing with 34 additions and 0 deletions
#include <IRremote.h>
const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop(){
if (irrecv.decode(&results)){
//Serial.println(results.value, HEX); // results.value is long unsigned int
//Serial.println(results.decode_type);
irrecv.resume();
}
switch(results.value) {
case 0x707048B7:
Serial.println("Forward");
break;
case 0x7070C837:
Serial.println("Backward");
break;
case 0x707028D7:
Serial.println("Right");
break;
case 0x7070A857:
Serial.println("Left");
break;
}
results.value = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment