From 0b7db06db124ccffb6d87e97599938b377ee1368 Mon Sep 17 00:00:00 2001 From: geremy@pubnub.com Date: Sun, 28 Dec 2014 17:06:50 -0800 Subject: adjusting for better flickering --- python/examples/pnPWM/Servo_Example.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'python/examples/pnPWM') diff --git a/python/examples/pnPWM/Servo_Example.py b/python/examples/pnPWM/Servo_Example.py index c5ca88a..cb0185f 100644 --- a/python/examples/pnPWM/Servo_Example.py +++ b/python/examples/pnPWM/Servo_Example.py @@ -2,13 +2,14 @@ from Adafruit_PWM_Servo_Driver import PWM import time +import random # =========================================================================== # Example Code # =========================================================================== # Initialise the PWM device using the default address -pwm = PWM(0x40, debug=True) +pwm = PWM(0x40, debug=False) # Note if you'd like more debug output you can instead run: #pwm = PWM(0x40, debug=True) @@ -30,9 +31,9 @@ while (True): for x in range(0,15) : # Change speed of continuous servo on channel O pwm.setPWM(x, x, servoMin) - time.sleep(0.0001) + time.sleep(random.uniform(0.005,0.0001)) pwm.setPWM(x, x, servoMax) - time.sleep(0.0001) + time.sleep(random.uniform(0.005,0.0001)) -- cgit v1.2.3