I'm using a Raspberry Pi 3 Model B running Raspbian Stretch
Using it somewhat like an RC car with an L298N H-bridge motor driver to control two DC motors.
It was working fine until a few days ago but now for some reason it isn't working. After checking I have found that the GPIO pins are always set at 0V.
Here's the code I'm using :
import time
import wiringpi as wp
wp.wiringPiSetupGpio()
m1x=26
m1y=20
m2x=19
m2y=16
m1e=13
m2e=21
wp.pinMode(m1x,1)
wp.pinMode(m1y,1)
wp.pinMode(m1e,1)
wp.pinMode(m2x,1)
wp.pinMode(m2y,1)
wp.pinMode(m2e,1)
def forward(dist):
wp.digitalWrite(m1x,1)
wp.digitalWrite(m1y,0)
wp.digitalWrite(m2x,1)
wp.digitalWrite(m2y,0)
wp.digitalWrite(m1e,1)
wp.digitalWrite(m2e,1)
print('Moving forward')
time.sleep(dist)
wp.digitalWrite(m1e,0)
wp.digitalWrite(m2e,0)
while(1):
forward(10)
The program runs but without the motors running. The motors are fine,the H-bridge lights up when power supply is switched on so the problem is with the Raspberry Pi I believe.
Using gpio readall
I saw that the voltage of all the pins is always set to 0. I am unable to change the voltage.
The 6 GPIO pins I am using switch to output mode but the voltage remains 0 instead of switching to 1.
I am at my wit's end. Is my pi faulty or is this something fixable?