Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define canal1 13
- #include <RCSwitch.h>
- RCSwitch mySwitch = RCSwitch();
- bool led = false;
- void setup()
- {
- pinMode(canal1 ,OUTPUT);
- digitalWrite(canal1 , LOW);
- Serial.begin(9600);
- mySwitch.enableReceive(0);
- }
- void loop()
- {
- if (mySwitch.available())
- {
- long int value = mySwitch.getReceivedValue();
- if (value == 0)
- {
- Serial.println("ERRO DE CODIGO");
- }
- else
- {
- Serial.println("Codigo desconhecido");
- Serial.println(mySwitch.getReceivedValue());
- if(value == 5633795)
- {
- if (led)
- {
- digitalWrite(canal1 , HIGH);
- Serial.println("LED LIGADO");
- }
- else
- {
- digitalWrite(canal1 , LOW);
- Serial.println("LED DESLIGADO");
- }
- led != led;
- }
- mySwitch.resetAvailable();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement