Hello guys, I am trying to control an LED with two Arduino UNO's with RF modules and a Push button.For some reason the code ain't working.I have attached the codes in the attachments.Let me know whats the problem.Thank you!
PaulS:
Why do you have two variables named msg2? Why does the name have a 2 in it at all?
It is because , basically I have adapted the code from a RF Controlled robot . I didnt bothered to change them.
PaulS:
The if STATEMENT does NOT loop!
Was in a hurry while writing ,LOL.
PaulS:
What kind of hardware are you using? How is the hardware connected to the Arduinos? What do your debug statements tell you is happening?
Its a Just a cheap pair of 433 MHz modules you'll find in local shops.I have used them in various other projects , So i am pretty sure there's no problem with the modules.Regarding debug statements , When the transmitter sends a message the LED on Pin 13 should blink ( but it doesn't) . In my opinion, the problem lies within the code.
Regarding debug statements , When the transmitter sends a message the LED on Pin 13 should blink ( but it doesn't) . In my opinion, the problem lies within the code.
Your assumption that the LED on pin 13 on the transmitter Arduino should blink when the transmitter sends data is erroneous. That assumption could ONLY be valid if the transmitter controlled the LED. It does not.
The LED on pin 13 should come on when the switch IS pressed, assuming that you have wired the switch with an external resistor in pullup configuration (why not use the internal pullup resistor, and make wiring easier?). The LED should then go off as soon as the transmitter has done sending the data.
How long do you suppose it takes to transmit 1 character, even at the slow speed of 2000 bits per second (you are sending 8 bits)?
Can you even see the LED come on for 0.004 seconds?
PaulS:
Your assumption that the LED on pin 13 on the transmitter Arduino should blink when the transmitter sends data is erroneous. That assumption could ONLY be valid if the transmitter controlled the LED. It does not.
The LED on pin 13 should come on when the switch IS pressed, assuming that you have wired the switch with an external resistor in pullup configuration (why not use the internal pullup resistor, and make wiring easier?). The LED should then go off as soon as the transmitter has done sending the data.
How long do you suppose it takes to transmit 1 character, even at the slow speed of 2000 bits per second (you are sending 8 bits)?
Can you even see the LED come on for 0.004 seconds?
A Serial.print() statement is more persistent.
Well I didn't meant to say 'blink' , actually I setup the LED to stay ON as long as the message is being sent and will turn OFF once the message has been sent.Now I have used the serial statements , it should print "MESSAGE SENT" once it had sent the message , but i am getting "MESSAGE SENT" constantly no matter if I press the button or not.