1
0
mirror of https://github.com/Adam-Ant/WatchedPotNeverBoils synced 2024-06-14 11:07:23 +00:00
WatchedPotNeverBoils/WatchPotNeverBoils.ino
2017-10-02 22:30:36 +01:00

45 lines
838 B
C++

/*
Send an n to turn on, a f to turn off
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int inbyte = 0; // for incoming serial data
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
// Optional set protocol (default is 1, will work for most outlets)
// mySwitch.setProtocol(2);
// Optional set pulse length.
mySwitch.setPulseLength(242);
// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
}
void loop() {
/* Same switch as above, but using binary code */
if (Serial.available() > 0) {
inbyte = Serial.read();
switch (inbyte) {
case 102:
mySwitch.send("000011110000000000000000");
case 110:
mySwitch.send("000011110000000011000000");
}
}
}