i using pi2 , mcp23017 expander. have succesfully setup wiringpi in can press switch connected input on bank b , lights corresponding led on bank a.
problem trying use interrupts - have code -
error message nameerror: name int_edge_both not defined.
thought line 12 define line.
don't mind if rising or falling trigger.
missing?
thanks
problem trying use interrupts - have code -
code: select all
import wiringpi import sleep pin_base = 65 i2c_addr = 0x20 wiringpi.wiringpisetup() # initialise wiringpi wiringpi.mcp23017setup(pin_base, i2c_addr) wiringpi.pinmode(80,0) # sets pin of mcp23s17-0 input wiringpi.pullupdncontrol(80, 1) #pulldown wiringpi.wiringpiisr(80, int_edge_rising, my_int) wiringpi.pinmode(65,1) # sets pin of mcp23017-0 output wiringpi.digitalwrite(65,0) # sets pin of mcp23017-0 0 (0v, off) def my_int(): print('led on.') wiringpi.digitalwrite(65,1) return true while true: time.sleep(1) print('waiting...') wiringpi.wiringpiisr(80, int_edge_rising, my_int) wiringpi.digitalwrite(65,0)
error message nameerror: name int_edge_both not defined.
thought line 12 define line.
don't mind if rising or falling trigger.
missing?
thanks
raspberrypi
Comments
Post a Comment