add basic rc switching capability
This commit is contained in:
parent
b2ef88fd0a
commit
f12026d900
2 changed files with 30 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
*/node_modules/*
|
||||
arduino/.build/*
|
||||
|
|
|
@ -1,8 +1,37 @@
|
|||
#include <RCSwitch.h>
|
||||
|
||||
int incomingByte = 0;
|
||||
boolean on = false;
|
||||
RCSwitch mySwitch = RCSwitch();
|
||||
int mode = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
mySwitch.enableTransmit(3);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Reference in a new issue