Skip to content

Commit 595bf94

Browse files
author
Igor Anokhin
committed
python: LED: add Navio+ support
Add root check Add Navio+ entry and auto choice shield
1 parent 590ec3b commit 595bf94

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Python/LED.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import sys
2-
3-
import navio.leds
41
import time
5-
import navio.util
2+
import os
3+
4+
import navio.Common.util
5+
if navio.Common.util.get_navio_version() == "NAVIO2":
6+
import navio.Navio2.Led as Led
7+
else:
8+
import navio.Navio.Led as Led
9+
610

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

9-
led = navio.leds.Led()
15+
navio.Common.util.check_apm()
16+
17+
led = Led()
1018

1119
led.setColor('Yellow')
1220
print "LED is yellow"
@@ -37,3 +45,4 @@
3745
led.setColor('Yellow')
3846
print "LED is yellow"
3947
time.sleep(1)
48+

0 commit comments

Comments
 (0)