auto-awning-close/_no-idea-what-it-is/main/receiver/receiver.ino
2021-05-22 15:06:38 +02:00

50 lines
1.0 KiB
C++

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int delayTime = 2000;
void setup()
{
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}
void loop()
{
if (mySwitch.available())
{
/* Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() ); */
switch(mySwitch.getReceivedValue())
{
case 16736113:
Serial.println("aaaaaaaaaa");
delay(delayTime);
break;
case 3696136:
Serial.println("bbbbbbbbbb");
delay(delayTime);
break;
case 16736120:
Serial.println("cccccccccc");
delay(delayTime);
break;
case 16736114:
Serial.println("dddddddddd");
delay(delayTime);
break;
}
mySwitch.resetAvailable();
}
}