@petewill I've managed to get the binary code with Audacity quite easy but got stuck as for each button pressed sends out a combination of codes.
Just for the open, always the same code in binary, 0111000000001100100011001110000100011110 twice and then 0111000000001100100011001110000100010001 three times.
//Define Variables
#define SEND_DATA 3 //Data pin for RF Transmitter
#define ZERO_HIGH 376 //Delay for the high part of a 0 in microseconds
#define ZERO_LOW 648 //Delay for the low part of a 0 in microseconds
#define ONE_HIGH 713 //Delay for the high part of a 1 in microseconds
#define ONE_LOW 306 //Delay for the low part of a 1 in microseconds
int startUp = 1;
unsigned char standardBits1 = 0b01110000; //sequence with "0b" prefix
unsigned char standardBits2 = 0b00001100;
unsigned char standardBits3 = 0b10001100;
unsigned char standardBits4 = 0b11100001;
unsigned char standardBits5 = 0b00011110;
unsigned char standardBits6 = 0b00010001;
int steps = 1;
//0111000000001100100011001110000100011110 x2
//0111000000001100100011001110000100010001 x3
void setup() {
Serial.begin(9600);
}
void loop()
{
if(startUp == 1)
{
oneBits(standardBits1);
oneBits(standardBits2);
oneBits(standardBits3);
oneBits(standardBits4);
oneBits(standardBits6);
twoBits(standardBits1);
twoBits(standardBits2);
twoBits(standardBits3);
twoBits(standardBits4);
twoBits(standardBits5);
startUp = 1; //to keep repeating
delayMicroseconds(5000);
}
}
void oneBits(unsigned char bits){
unsigned char k;
int delayTime;
for(k=0;k<8;k++) {
int highTime;
int lowTime;
delayTime = ((bits>>(7-k)) & 1 ? 1 : 0);
if (delayTime == 1){
highTime = ONE_HIGH;
lowTime = ONE_LOW;
}
else {
highTime = ZERO_HIGH;
lowTime = ZERO_LOW;
digitalWrite(SEND_DATA, HIGH);
delayMicroseconds(highTime);
digitalWrite(SEND_DATA, LOW);
delayMicroseconds(lowTime);
}
}
}
void PAUSE()
{
delayMicroseconds(1650);
}
void twoBits(unsigned char bits)
{
unsigned char l;
int delayTime;
for(l=0;l<8;l++)
{
int highTime;
int lowTime;
delayTime = ((bits>>(7-l)) & 1 ? 1 : 0);
if (delayTime == 1){
highTime = ONE_HIGH;
lowTime = ONE_LOW;
}
else {
highTime = ZERO_HIGH;
lowTime = ZERO_LOW;
}
digitalWrite(SEND_DATA, HIGH);
delayMicroseconds(highTime);
digitalWrite(SEND_DATA, LOW);
delayMicroseconds(lowTime);
}
}
I'm seeing the 'results' back on Audacity since the code is set on a loop. Not to complicate more I'm just using 2 different codes but they are broadcasted to each other.
Is there anything I could do to separate them as any delay in between the processes won't work??
Thanks
Carl