I GOT IT WORKING!
So what I posted before actually worked, with the delays and such.
It just took a lot of tweaking and tuning to get the desired timing.
int button1array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,0};
int button2array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0};
int button3array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,1,1,0,0,0};
int button4array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0};
int button5array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0};
int button6array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,1,0};
int button7array[25] = {0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0};
const int tx = 2;
void setup()
{
pinMode(tx, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int buttonPressed = Serial.read();
if (buttonPressed == '1')
{
for (int i = 0; i<25; i++)
{
if (button1array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '2')
{
for (int i = 0; i<25; i++)
{
if (button2array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '3')
{
for (int i = 0; i<25; i++)
{
if (button3array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '4')
{
for (int i = 0; i<25; i++)
{
if (button4array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '5')
{
for (int i = 0; i<25; i++)
{
if (button5array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '6')
{
for (int i = 0; i<25; i++)
{
if (button6array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
if (buttonPressed == '7')
{
for (int i = 0; i<25; i++)
{
if (button7array[i] == 1)
{
digitalWrite(tx, HIGH);
delayMicroseconds(650);
digitalWrite(tx, LOW);
delayMicroseconds(210);
}
else
{
digitalWrite(tx, HIGH);
delayMicroseconds(210);
digitalWrite(tx, LOW);
delayMicroseconds(650);
}
}
}
}
based on what you enter in the Serial monitor, the rf module transmits that signal.
I compared the waveforms in audacity and they are pretty close to each other.
I guess this is solved.
Thanks a lot Peter for you help!