Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python examples rework #27

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
python: LED: add Navio+ support
Add root check
Add Navio+ entry and auto choice shield
  • Loading branch information
Igor Anokhin committed Jan 10, 2018
commit f2023ff173c3f2e7db07521360890b026a4df511
21 changes: 15 additions & 6 deletions Python/LED.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import sys

import navio.leds
import time
import navio.util
import os

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


navio.util.check_apm()
if (os.getuid() != 0):
print "Not root. Please, launch like this: sudo python LED.py"
exit(-1)

led = navio.leds.Led()
navio.Common.util.check_apm()

led = Led()

led.setColor('Yellow')
print "LED is yellow"
Expand Down Expand Up @@ -37,3 +45,4 @@
led.setColor('Yellow')
print "LED is yellow"
time.sleep(1)