add basic rc switching capability

This commit is contained in:
Shannon Sterz 2016-01-12 20:05:43 +01:00
parent b2ef88fd0a
commit f12026d900
2 changed files with 30 additions and 0 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
*/node_modules/* */node_modules/*
arduino/.build/*

View file

@ -1,8 +1,37 @@
#include <RCSwitch.h>
int incomingByte = 0;
boolean on = false;
RCSwitch mySwitch = RCSwitch();
int mode = 0;
void setup() void setup()
{ {
Serial.begin(9600);
mySwitch.enableTransmit(3);
} }
void loop() void loop()
{ {
if(Serial.available()) {
incomingByte = Serial.read();
switch(mode)
{
case 126:
if(on) {
controlRCOutlets("0FFF0FFF0000");
on = false;
} else {
controlRCOutlets("0FFF0FFF000F");
on = true;
}
}
}
}
void controlRCOutlets(const char* sCodeWord) {
mySwitch.sendTriState(sCodeWord);
delay(1000);
} }