-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutlet.cpp
More file actions
23 lines (18 loc) · 726 Bytes
/
outlet.cpp
File metadata and controls
23 lines (18 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "../rc-switch/RCSwitch.h"
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int PIN = 0; // wiring Pi layout
int codeSocketDon = 1049937; // code to turn socket on
int codeSocketDoff = 1049940; // code to turn socket off
if (wiringPiSetup() == -1) return 1;
RCSwitch mySwitch = RCSwitch();
mySwitch.enableTransmit(PIN);
if (atoi(argv[1]) == 1) { // if program is startet with argument '1'
mySwitch.send(codeSocketDon, 24);
} else {
mySwitch.send(codeSocketDoff, 24);
}
return 0;
}
// Source: https://tutorials-raspberrypi.de/raspberry-pi-funksteckdosen-433-mhz-steuern/