mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
22 lines
423 B
Python
22 lines
423 B
Python
import TemplateDevice
|
|
|
|
io1 = TemplateDevice.GPIO()
|
|
io1.setPin('PA8')
|
|
io1.setMode('in')
|
|
io1.enable()
|
|
|
|
EVENT_SIGAL_IO_RISING_EDGE = 0x01
|
|
EVENT_SIGAL_IO_FALLING_EDGE = 0x02
|
|
|
|
|
|
def callBack1(signal):
|
|
if signal == EVENT_SIGAL_IO_RISING_EDGE:
|
|
print('get rising edge!')
|
|
elif signal == EVENT_SIGAL_IO_FALLING_EDGE:
|
|
print('get falling edge!')
|
|
else:
|
|
return signal
|
|
|
|
|
|
io1.addEventCallBack(callBack1)
|