0% found this document useful (0 votes)
26 views1 page

Ver4 Led Buz

Uploaded by

1510045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

Ver4 Led Buz

Uploaded by

1510045
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//version 4

#include <IRremote.h>
#define IR_RECV 4

int LED1 = 5;
int LED2 = 7;
int LED3 = 6;
int buz = 8;

void setup() {
Serial.begin(9600);
IrReceiver.begin(IR_RECV);
pinMode (LED1,OUTPUT);
pinMode (LED2, OUTPUT);
pinMode (LED3, OUTPUT);
pinMode (buz,OUTPUT);

void loop() {
if (IrReceiver.decode())
{
unsigned long code = IrReceiver.decodedIRData.decodedRawData;
if(code = 0xF30FF00){ //LED 1, 1
digitalWrite(LED1,HIGH);
}
else if(code = 0xE718FF00) { //LED 2, 2
digitalWrite(LED2,HIGH);
}
else if (code = 0xA15EFF00){ //LED 3, 3
digitalWrite(LED3,HIGH);
}
else if (code = 0xF708FF00) { //LED123 = OFF, 4
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
}
else if (code = 0xE31CFF00) { //buz on 5
digitalWrite(buz, HIGH);
}
else if (code = 0xA55AFF00) { //buz off 6
digitalWrite(buz, LOW);
}
else if (code = 0xBD42FF00) { //led123 buz on 7
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
digitalWrite(buz, HIGH);
}
else if (code = 0xAD52FF00) { //led123 buz off 8
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
digitalWrite(buz, LOW);
}
else {Serial.println("INVALID")}
IrReceiver.resume();
}
}

You might also like