RcSwitch
Module for operate 433/315Mhz devices like power outlet sockets, relays, etc. Use the RcSwitch module for it.
Support for sending is implemented, but receiving isn't.
Picture of a 433Mhz transmitter (left) and receiver (right):
Wire the 433Mhz transmitter up as follows:
Device Pin | Espruino |
---|---|
1 (GND) | GND |
2 (VCC) | BAT |
3 (DATA) | A0 |
How to use the module:
// 1 = Protocol number (1..6)
// A0 = Pin
// 10 = Amount of times to repeat the code
var sw = require("RcSwitch").connect(1, A0, 10);
var on = false;
function toggle() {
on = !on;
if (on) {
sw.switchOn("11110", "10000");
console.log("switchOn");
}
else{
sw.switchOff("11110", "10000");
console.log("switchOff");
}
}
setInterval(toggle, 5000);
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.