examples: hello_isr.py now catches exception if invalid pin is specified
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
a51f3a939f
commit
143bc38e47
@@ -43,9 +43,12 @@ if (len(sys.argv) == 2):
|
||||
pin = int(sys.argv[1], 10)
|
||||
except ValueError:
|
||||
printf("Invalid pin " + sys.argv[1])
|
||||
print("Starting ISR for pin " + repr(pin))
|
||||
x = mraa.Gpio(pin)
|
||||
x.dir(mraa.DIR_IN)
|
||||
x.isr(mraa.EDGE_BOTH, test, x)
|
||||
var = raw_input("Press ENTER to stop")
|
||||
x.isrExit()
|
||||
try:
|
||||
x = mraa.Gpio(pin)
|
||||
print("Starting ISR for pin " + repr(pin))
|
||||
x.dir(mraa.DIR_IN)
|
||||
x.isr(mraa.EDGE_BOTH, test, x)
|
||||
var = raw_input("Press ENTER to stop")
|
||||
x.isrExit()
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
|
||||
Reference in New Issue
Block a user