RC Switch IR-Input
i'm trying switch stuff on , off pushing same button.
right need 2 button. how have modify code? there 1 button?
#include "irremote.h"
#include <rcswitch.h>
const int infrarot = 11;
irrecv irrecv(infrarot); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
rcswitch myswitch = rcswitch(); //
void setup()
{
serial.begin(9600);
myswitch.enabletransmit(10); //rf-modul pin 10
irrecv.enableirin(); // start receiver
}
void loop()
{
if (irrecv.decode(&results))
{
translateir();
irrecv.resume();
}
}
void translateir()
{
switch(results.value)
{
case 0xdaea83ec:
serial.println("on"); //swicht channel on
myswitch.switchon("11111", "01000") ;
break;
case 0xe51b354e:
serial.println("off"); //swicht chanel off
myswitch.switchoff("11111", "01000");
break;
}
delay(500);
}
right need 2 button. how have modify code? there 1 button?
#include "irremote.h"
#include <rcswitch.h>
const int infrarot = 11;
irrecv irrecv(infrarot); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
rcswitch myswitch = rcswitch(); //
void setup()
{
serial.begin(9600);
myswitch.enabletransmit(10); //rf-modul pin 10
irrecv.enableirin(); // start receiver
}
void loop()
{
if (irrecv.decode(&results))
{
translateir();
irrecv.resume();
}
}
void translateir()
{
switch(results.value)
{
case 0xdaea83ec:
serial.println("on"); //swicht channel on
myswitch.switchon("11111", "01000") ;
break;
case 0xe51b354e:
serial.println("off"); //swicht chanel off
myswitch.switchoff("11111", "01000");
break;
}
delay(500);
}
hey there changed code i#m still searching solution.
Arduino Forum > Using Arduino > Project Guidance > RC Switch IR-Input
arduino
Comments
Post a Comment