Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Raspberry Pi 3 : Servo Motor unusual movement in Python

$
0
0

I'm new in python especially in Raspberry Pi and I'm confused why my servo motor have unusual movement it movable sometimes , I have servo motor Tower Pro Micro servo 9g,why it is happening should I clean up or close the servo? can someone help me with this

this is my code let say whether it goes to true or false it has unusual movement

import osimport jsonfrom gpiozero import Servofrom time import sleep# Define servo GPIO pinmyGPIO = 17# Create servo object using the pigpio pin factoryservo = Servo(myGPIO)# URL for HTTP requesturl = "http://192.0.0.0/rest-api-examples/rest-api/data.php"cmd = "curl -s -k " + urlprint(cmd)print("\n")try:    while True:        result = os.popen(cmd).read()        if result:            print(result)            arr = json.loads(result)            data = arr["servo"]            print("\n")            print("Trigger:", data)            if data:                print("True")                servo.min()                print("min")                sleep(10)                servo.max()                sleep(10)            else:                servo.max()                print("false")        else:            print("No result")except Exception as e:    print(e)

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>