Hello all, I've encountered a problem when trying to make and run an electric vehicle using motor shield l293 and TSOP 1738 IR sensor and remote kit. I'm new to coding in arduino and I can't think of any possible problems. The programs just breezes through all the statements and executes just the serial.print command within the loop. I've attached the code below.
Thank you in Advance!
Do the commands to run forward, backwards etc work if you execute them on their own ?
A suggestion, put the code for each type of movement in a function with a sensible name. This won't solve the problem but will make the code more readable and would allow you to call such functions to test the motors without adding duplicate code
I note that you do this
if (irrecv.decode(&result))
{
Serial.println(result.value, DEC);//store the decimal equivalent of the signal in the result variable
irrecv.resume();
delay(500);
if (result.value == 33478695) //FORWARD
What is the value of result.value after doing the irrrecv.resume ? Try printing it.
The motor shield is powered by a 9VDC battery, the motors run perfectly fine before I used the IRreciever library. When I execute the program, the if statements are getting triggered as they should be, I verified this using serial.print statements in every loop, but the motors wont run as per the respective loop statements at all.
The value remains same after the signal is received, but the values change from the preset values after the next button push.