0

lately i installed servoblaster to my raspberry pi and then tried a simple python code `

import os
import time

os.system('sudo ./servod')

while True:
    os.system("echo 1=100 > /dev/servoblaster")
    time.sleep(0.5)
    os.system("echo 1=1 > /dev/servoblaster")
    time.sleep(2)

i put the code in the directory of servoblaster /home/pi/PiBits/ServoBlaster/user/file1.py but when run sudo python file1.py this what i got

pi@raspberrypi:~/PiBits/ServoBlaster/user $ sudo python file1.py
Board model:                     2
GPIO configuration:            P1 (40 pins)
Using hardware:                PWM
Using DMA channel:              14
Idle timeout:             Disabled
Number of servos:                8
Servo cycle time:            20000us
Pulse increment step size:      10us
Minimum width value:            50 (500us)
Maximum width value:           250 (2500us)
Output levels:              Normal

Using P1 pins:               7,11,12,13,15,16,18,22

Servo mapping:
     0 on P1-7           GPIO-4
     1 on P1-11          GPIO-17
     2 on P1-12          GPIO-18
     3 on P1-13          GPIO-27
     4 on P1-15          GPIO-22
     5 on P1-16          GPIO-23
     6 on P1-18          GPIO-24
     7 on P1-22          GPIO-25

Invalid width specified
Invalid width specified
Invalid width specified
Invalid width specified
Invalid width specified
Invalid width specified
Invalid width specified

Can you please tell me what's wrong.

1 Answer 1

1

Invalid width specified

See https://github.com/richardghirst/PiBits/tree/master/ServoBlaster

Generally a servo will expect pulse widths in the range 1000 to 2000 microseconds although some will go between 500 to 2500.

os.system("echo 1=100 > /dev/servoblaster")

sets 1000µs which should be okay.

os.system("echo 1=1 > /dev/servoblaster")

sets 10µs which will be invalid.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.