I know I asked this question before, but this time I will give a more clearer description. I have been using the raspberry pi for approximately 6 months now. I am making a very simple robot car that includes a motor and ultrasonic sensor circuit. The ultrasonic sensor works perfectly but the motors aren't spinning with my circuit and programs. Please help:
Then I programmed the circuit using the raspberry pi using python and the RPi.GPIO library / module. The code is below:
# importing all modules import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) # Setting up gpio pins for output GPIO.setup(37, GPIO.OUT) GPIO.setup(35, GPIO.OUT) GPIO.setup(33, GPIO.OUT) GPIO.setup(31, GPIO.OUT) # Moving the car/ rotating the motor # This part just moves the car front for 2 secs then back for 2 secs GPIO.output(37, True) GPIO.output(33, True) time.sleep(2) GPIO.output(37, False) GPIO.output(33, False) time.sleep(2) GPIO.output(35, True) GPIO.output(31, True) time.sleep(2) GPIO.output(35, False) GPIO.output(31, False) # Cleaning up GPIO.cleanup()
There are no errors in the code when I run it (If there are in the code above, then that's probably true because I didn't copy and paste the code, I just wrote it here, so there might be a typo or something). The program just doesn't do anything. I ran it on idle in the raspberry pi. Please help, any good help will be useful thank you! Thank you as it means a lot!!