1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- import time, sys, signal, atexit
- import pyupm_rpr220 as upmRpr220
-
-
-
-
-
- myReflectiveSensor = upmRpr220.RPR220(2)
-
-
-
-
- def SIGINTHandler(signum, frame):
- raise SystemExit
-
-
-
- def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-
- atexit.register(exitHandler)
- signal.signal(signal.SIGINT, SIGINTHandler)
-
-
- while(1):
- if (myReflectiveSensor.blackDetected()):
- print "Black detected"
- else:
- print "Black NOT detected"
-
- time.sleep(.1)
|