Keyestudio Smart Little Turtle Robot V3 Manual page 112

Table of Contents

Advertisement

www.keyestudio.com
decode_results results;
void setup()
{Serial.begin(9600);
irrecv.enableIRIn(); //Initialize the IR receiver
pinMode(LED_PIN,OUTPUT);//set pin 4 of LED to OUTPUT
}
void loop() {
if (irrecv.decode(&results))
{
if(results.value==0xFF02FD && (a==0)) //according to the above key
value, press"OK"on remote control , LED will be controlled
{
Serial.println("HIGH");
digitalWrite(LED_PIN,HIGH);//LED will be on
a=1;
}
else if(results.value==0xFF02FD && (a==1)) //press again
{
Serial.println("LOW");
digitalWrite(LED_PIN,LOW);//LED will go off
112

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents