I am doing a project where I press a key from a matrix keypad(4*4) and correspondingly a particular signal is transmitted .On receiving that signal, it will initiate some action.
I am attaching my transmitter and receiver code. I am trying to make a keypad control of direction of motion of a car wirelessly.
According to my program, if the signal is high and then low, the car moves forward for 5 sec.
If high and then high again, the car moves towards left for 5 sec.
If low and then high, the car turns right.
If low and then low, it moves backward.
Every transmission start with a low signal to make the receiver understand that transmission has started.
When no key is pressed, it will transmit high and the receiver should receive high.
This is working only upto 2 metres approx. but for more than 2 metres, it starts receiving various combinations of ones and zeroes even when no key is pressed but according to my program,it should have received high continuously if no key is pressed.
Please tell me a solution to the above problem otherwise I cannot make my car to move the way I want.
Transmit code.ino (2.68 KB)
Receive code.ino (2.1 KB)