0
arduino communication via the serial port
Iâve been working on a robot. The motors are drive via an adafruit motor driver on an arduino uno r3. Iâm working on controlling it from my raspberry pi using python. When I connect via the serial port from the python shell I can send my commands, in this case âForwardâ, âReverseâ, âStopâ, âLeftâ, and âRightâ. But, when I put the exact same code into a file, it doesnât work properly. It runs the code without any errors, but it should in the case of the code, go forward for 2 seconds, and then stop. Iâm using PySerial to communicate with the arduino. Any suggestions as to what might be my issue would be very much appreciated! :)
2 Answers
+ 1
can you post the code? i have a slight suspicion that either you forgot to import something in the file that you did in IDLE, or the delays are not placed right. use code playground to do so (dont be offended if you know code better than i thought you did. ive seen some weird things just a moment ago).
+ 1
No offense taken, for all I know I could have just screwed up some imports, although I dont think I did. Here is the code that is on the arduino
https://code.sololearn.com/cA35a4a24A16/?ref=app
and here is the code iâm running from my pi
https://code.sololearn.com/cai37dUufMGP/?ref=app
The delays could definitely be a possibility, but tbh iâm not too experienced working w/ the arduino.