#include "/home/lucas/433Utils/rc-switch/RCSwitch.h" #include #include int main(int argc, char *argv[]) { // This pin is not the first pin on the RPi GPIO header! // Consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/ // for more information. int PIN = 0;//G17 // Parse the first parameter to this command as an integer int protocol = 2; // A value of 0 will use rc-switch's default value int pulseLength = 0; int length = 24; // If no command line argument is given, print the help text if (argc == 1) { printf("Usage: %s decimalcode [protocol] [length] [pulselength]\n", argv[0]); printf("decimalcode\t- As decoded by RFSniffer\n"); printf("protocol\t- According to rc-switch definitions\n"); printf("length\t\t- Whatever the Fuck U want\n"); printf("pulselength\t- pulselength in microseconds\n"); return -1; } // Change protocol and pulse length accroding to parameters int code = atoi(argv[1]); if (argc >= 3) protocol = atoi(argv[2]); if (argc >= 4) length = atoi(argv[3]); if (argc >= 5) pulseLength = atoi(argv[4]); if (wiringPiSetup () == -1) return 1; printf("sending code[%i]\n", code); RCSwitch mySwitch = RCSwitch(); if (protocol != 0) mySwitch.setProtocol(protocol); if (pulseLength != 0) mySwitch.setPulseLength(pulseLength); mySwitch.enableTransmit(PIN); mySwitch.send(code, length); return 0; }