You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tried to make it so that if something is infront of my ultrasonic sensor then the motor turns on but as soon as theres nothing infront of it the motor stops but for some reason the motor never stops.
`import RPi.GPIO as GPIO
import time
import PiMotor
while True:
US1.sonicCheck()
time.sleep(0.5)
if US1.Triggered == True:
print('Starting')
m1.forward(40)
else:
print('Stopping')
m1.stop`
when i run this script and stand infront of the sensor the motor turns on but when i move out the way the motor stays on but it prints "stopping" which means the else part of the if statement is being executed but the motor doesnt stop, the .stop function does work ive tried but for some reason here it doesnt work.
The text was updated successfully, but these errors were encountered:
tried to make it so that if something is infront of my ultrasonic sensor then the motor turns on but as soon as theres nothing infront of it the motor stops but for some reason the motor never stops.
`import RPi.GPIO as GPIO
import time
import PiMotor
GPIO.setwarnings(False)
US1 = PiMotor.Sensor("ULTRASONIC", 40)
m1 = PiMotor.Motor("MOTOR1", 2)
while True:
US1.sonicCheck()
time.sleep(0.5)
if US1.Triggered == True:
print('Starting')
m1.forward(40)
else:
print('Stopping')
m1.stop`
when i run this script and stand infront of the sensor the motor turns on but when i move out the way the motor stays on but it prints "stopping" which means the else part of the if statement is being executed but the motor doesnt stop, the .stop function does work ive tried but for some reason here it doesnt work.
The text was updated successfully, but these errors were encountered: