-
-
Save spawnrider/7be9b7c33b4c0a583689 to your computer and use it in GitHub Desktop.
/* | |
Auteur : Yohann Ciurlik | |
Codes commandes OTIO 433MHz Ref. 09HA02 | |
Ces codes peuvent etre utilisés avec la libraire RC-Switch disponible sur : | |
http://code.google.com/p/rc-switch/ | |
----------------------------------------------- | |
Mode: 32 bit | |
Protocol: 2 | |
UP : 892433920 | |
DOWN : 959542784 | |
*/ | |
#include "RCSwitch.h" | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
if (wiringPiSetup () == -1) return 1; | |
RCSwitch rf_cmd = RCSwitch(); // initialisation | |
rf_cmd.enableTransmit(0); // emetteur sur la broche 10 | |
rf_cmd.setProtocol(2); // par defaut le protocole utilisé est le 1, mais les commandes OTIO utilisent le 2 | |
rf_cmd.setRepeatTransmit(15); // on repete la transmission 15 fois pour etre sur qu'elle arrive bien | |
rf_cmd.setPulseLength(700); // | |
rf_cmd.send(892433920, 32); | |
} |
here the error message when i want to build it 👍
g++ sendOTIO.cpp -o sendOTIO
/tmp/ccNYORJ2.o: In function main': sendOTIO.cpp:(.text+0x14): undefined reference to
wiringPiSetup'
sendOTIO.cpp:(.text+0x44): undefined reference to RCSwitch::RCSwitch()' sendOTIO.cpp:(.text+0x54): undefined reference to
RCSwitch::enableTransmit(int)'
sendOTIO.cpp:(.text+0x64): undefined reference to RCSwitch::setProtocol(int)' sendOTIO.cpp:(.text+0x74): undefined reference to
RCSwitch::setRepeatTransmit(int)'
sendOTIO.cpp:(.text+0x84): undefined reference to RCSwitch::setPulseLength(int)' sendOTIO.cpp:(.text+0x98): undefined reference to
RCSwitch::send(unsigned long, unsigned int)'
collect2: ld returned 1 exit status
: recipe for target 'sendOTIO' failed
make: *** [sendOTIO] Error 1
Here a working code (g++ -c -o send.o send.cpp OR replacing send.cpp file from RPutils and 'make'):
include <stdio.h>
int main(int argc, char *argv[]) {
int PIN = 0;
int systemCode = atoi(argv[1]);
if (wiringPiSetup () == -1) return 1;
RCSwitch rf_cmd = RCSwitch();
rf_cmd.enableTransmit(0);
rf_cmd.setProtocol(2);
rf_cmd.setRepeatTransmit(15);
rf_cmd.setPulseLength(700);
rf_cmd.send(systemCode, 32);
}
Use it with ex: sudo ./send 012345678
hey , thank's for this job .
But i can't make this file on my raspberry ...
I want send signal to my OTIO interrupteur receiver ....
Thanks for you're job !!