IR Sensor - Arduino
#include <IRremote.h>
int RECV_PIN = 7;
int LED = 13;
int speakerPin = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(LED, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
tone(speakerPin,1000,300);
switch(results.value)
{
case 0xC0B92:
Serial.println("fanculo");
break;
case 0xFF629D:
Serial.println(" CH ");
break;
}
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
irrecv.resume(); // Receive the next value
}
}