Radio transmission if loops

So I’ve got my 433MHz radio transmitters to send data to each other using the virtual wire library but the receiver Arduino is not carrying out my if loops. Thanks in advance for the help! Code in attachments.

transmitter.ino (1.33 KB)

reviever.ino (4.54 KB)

For informed help, please read and follow the instructions in the "How to use this forum" post.

Explain this statement, and provide evidence:

the receiver Arduino is not carrying out my if loops

Well in my receiver code I have 3 if loops that should run motors from an adafruit motor shield I have, the if loops are dependent on when the buttons I have on my transmitter arduino are pushed. For example if the left button is pushed, the value 0 is transmitter to the receiver arduino and then the if loop should run.

When the body of a if statement is not "carried out", the logical condition that you set is not TRUE.

So what exactly do you see in all your Serial prints? And I'd add one for receivedData.TX_ID too. From those you should be able to check which if statements should be doing anything.

Though with all those delays it's not going to be very responsive. You're only checking the transmission about once every 10 seconds or so.

Steve

if ((leftstate = 0)Oops!

else if ((rightstate = 0)Not again!

else if ((pullstate = 0)Yep, again.

Hi,
Have you tried removing the Tx and Rx units and wiring the two Arduinos together, a gnd to gnd wire and a Tx pin to Rx pin to see if you have your code correct, before adding a radio link.

Tom... :slight_smile: