Hello,
i have a sparkfun inventor’s kit.
i am trying to complete project 5A but the motor will not spin backwards. :?
<LINK_TEXT text="https://github.com/sparkfun/SIK-Guide-C … asics.ino
">SIK-Guide-Code/SIK_Circuit_5A-MotorBasics/SIK_Circuit_5A-MotorBasics.ino at master · sparkfun/SIK-Guide-Code · GitHub
</LINK_TEXT>
i have poured throug the code looking a a clue but to no avail.
can you please suggest a fix?
Hi RBEKHOUT,
Are you sending negative values (-130 to -255) in the serial monitor? If you are seeing the motor start and stop quickly, try turning on “No Line Ending” in the serial monitor and then re-send the speed values. That should resolve the issue.
Hi TS-Mark,
I’ve gone back over the wiring and code again and noticed a difference in the wiring picture in the SFIK book compared to the code.
the SFIK book wiring picture shows a green wire from motor driver PWMA to digital pin 13, however, the code tells AIN2 to be pin 13.
what is in the code:
//PIN VARIABLES
//the motor will be controlled by the motor A pins on the motor driver
const int AIN1 = 13; //control pin 1 on the motor driver for the right motor
const int AIN2 = 12; //control pin 2 on the motor driver for the right motor
const int PWMA = 11; //speed control pin on the motor driver for the right motor
what should be in the code:
//PIN VARIABLES
//the motor will be controlled by the motor A pins on the motor driver
const int AIN1 = 12; //control pin 1 on the motor driver for the right motor
const int AIN2 = 11; //control pin 2 on the motor driver for the right motor
const int PWMA = 13; //speed control pin on the motor driver for the right motor
Interestingly, the code history on GitHub shows the correct code at some point. the most recent (including the library downloaded to my system) has the error.
A lesson for me in checking logic as I go from now on.
Good catch! There are a few errors in the SIK Guidebook that comes with the kit that should be covered in the included Errata sheet. What I recommend for you and other users of the SIK is to follow the [Online Experiment Guide. That will have the most up-to-date and correct circuits and code.
Let us know if you run into any other issues with your Inventor’s Kit or if you have any questions about it and we would be happy to help.](https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v40)