forked from xkonni/raspberry-remote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.cpp
More file actions
29 lines (24 loc) · 682 Bytes
/
send.cpp
File metadata and controls
29 lines (24 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Usage: ./send <systemCode> <unitCode> <command>
* Command is 0 for OFF and 1 for ON
*/
#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* binaryCommand = argv[1];
if (wiringPiSetup () == -1) return 1;
piHiPri(20);
printf("sending binary[%s]\n", binaryCommand);
RCSwitch mySwitch = RCSwitch();
mySwitch.setPulseLength(300);
mySwitch.enableTransmit(PIN);
mySwitch.sendTriState(binaryCommand);
return 0;
}