Skip to content

Commit

Permalink
python: Servo: add Navio+ support
Browse files Browse the repository at this point in the history
Add root check
Add Navio+ entry and add shield auto choice
  • Loading branch information
Igor Anokhin committed Jan 10, 2018
1 parent 5a7a23a commit 323675f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Python/Servo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import sys
import time
import os

import navio.pwm
import navio.util
import navio.Common.util

navio.util.check_apm()
if navio.Common.util.get_navio_version() == "NAVIO2":
import navio.Navio2.RCOutput as RCOutput
else:
import navio.Navio.RCOutput as RCOutput

SERVO_MIN = 1.250 # ms
SERVO_MAX = 1.750 # ms
PWM_OUTPUT = 0
SERVO_MIN = 1.250 #ms
SERVO_MAX = 1.750 #ms

with navio.pwm.PWM(PWM_OUTPUT) as pwm:
if (os.getuid() != 0):
print "Not root. Please, launch like this: sudo python Servo.py"
exit(-1)

navio.Common.util.check_apm()

with RCOutput(PWM_OUTPUT) as pwm:
pwm.set_period(50)
pwm.enable()

Expand Down

0 comments on commit 323675f

Please sign in to comment.