-
The answer
01/20/2017 at 14:31 • 0 commentsAfter wiring you can use RCSwitch to send the string "101010101001101101100100" on 315MHz and get it to turn on or off. It's the same command for both since it's a single button switch.
- Wire up the transmitter
- Follow steps to Download and
Install WiringPi
https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
- Git clone https://github.com/r10r/rcswitch-pi
- Edit send.cpp and replace it
with this code
#include "RCSwitch.h" #include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]) { /* output PIN is hardcoded for testing purposes see https://projects.drogon.net/raspberry-pi/wiringpi/pins/ for pin mapping of the raspberry pi GPIO connector */ int PIN = 0; char* code = argv[1]; if (wiringPiSetup () == -1) return 1; printf("sending code[%d]\n", code); RCSwitch mySwitch = RCSwitch(); mySwitch.enableTransmit(PIN); mySwitch.setRepeatTransmit(2); mySwitch.send(code); return 0; }
- Run "make"
- Run ./send 101010101001