Skip to content

Instantly share code, notes, and snippets.

@spawnrider
Created September 29, 2014 21:06
Show Gist options
  • Save spawnrider/7be9b7c33b4c0a583689 to your computer and use it in GitHub Desktop.
Save spawnrider/7be9b7c33b4c0a583689 to your computer and use it in GitHub Desktop.
Send RF commands to OTIO receivers
/*
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);
}
@philaretexls
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment