I am building an obstacle avoidance robot with a Fundumoto shield which has specified pins to control 2 motors (pins 10,11,12,13 ) and set pins for plugging in an Ultrasonic sensor. (pin7,8). My motors work perfectly with my code until I start using the ultrasonic sensor. As soon as I use the sensor (with or without the newping.h library) the right wheel (B) which uses pins 11 and 13 can only go in one direction (reverse, which is LOW)
int SpeedA = 10;
int DirectionA = 12;
int SpeedB =11;
int DirectionB = 13;
I can't figure out what is happening!
I thought perhaps the newPing code was using the pin 13 for some timing purpose (some documentation on the web seems to suggest this), but then I used other code to run my Ultrasonic sensor (which does not need the newping.h or any other library) and the problem persists.
I attach my code in case this can help solve my problem. The real issue here is that I CAN'T change my motor pins as the shield does not allow that, so I MUST use pin13 (if that is the problem)
Is this my problem, and if so, is there another way around it (another library that uses different background timer pins or something like that)?
I also attach the picture of the shield I am using in case this helps.
I would really appreciate some help here, as I have tried so many things, but my understanding of what happens in the libraries and with the timers is too limited.
I use another library, the statemachine library called SM.h which could also be adding to my problem. ![]()
