Skip to content

Instantly share code, notes, and snippets.

@3ng1n33r
Created June 11, 2016 14:48
Show Gist options
  • Save 3ng1n33r/12095d1dea9dba5150f8c16410070af5 to your computer and use it in GitHub Desktop.
Save 3ng1n33r/12095d1dea9dba5150f8c16410070af5 to your computer and use it in GitHub Desktop.
CAME TOP 432 NA (433MHz) transmitter code
#define transmitPin 0 // RF transmit pin
#define ledPin 1
const int signalSize = 13;
/*
2 5 LH 2
2 5 LH 2
2 2 LL 1
5 2 HL 3
5 5 HH 4
2 2 LL 1
5 5 HH 4
2 2 LL 1
5 5 HH 4
2 2 LL 1
5 2 HL 3
5 5 HH 4
2 134 LVH 5
*/
int openSesame[] = {2, 2, 1, 3, 4, 1, 4, 1, 4, 1, 3, 4, 5};
// Play with this value timeDelay variable is anywhere between 75 and 135 microseconds
int timeDelay = 115;
void setup() {
pinMode(transmitPin, OUTPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int highLength = 0;
int lowLength = 0;
digitalWrite(ledPin, HIGH);
for(int i = 0; i < signalSize; i++) {
switch(openSesame[i]) {
case 1: // LL
highLength = 2;
lowLength = 2;
break;
case 2: // LH
highLength = 2;
lowLength = 5;
break;
case 3: // HL
highLength = 5;
lowLength = 2;
break;
case 4: // HH
highLength = 5;
lowLength = 5;
break;
case 5: // VLH
highLength = 2;
lowLength = 134;
break;
}
// transmit HIGH signal
digitalWrite(transmitPin, HIGH);
delayMicroseconds(highLength*timeDelay);
digitalWrite(transmitPin,LOW);
delayMicroseconds(lowLength*timeDelay);
}
digitalWrite(ledPin, LOW);
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment