Assertion Error: Pin 14 not set to input (MCP23017) - Raspberry Pi Forums
hey all,
i've built expansion board raspberry pi b has 2x mcp23017's on it. i've controlled relay's through , can detect inputs internal pull resistors enabled. of shows fine on webio interface. i'm trying automate sections of , getting errors when trying detect inputs.
error follows:- , code segment is:- more happy post complete code if needed.
mcp1 defined using mcp23017 library adafruit , client.publish paho mqtt library.
in advance,
liveitnerd
i've built expansion board raspberry pi b has 2x mcp23017's on it. i've controlled relay's through , can detect inputs internal pull resistors enabled. of shows fine on webio interface. i'm trying automate sections of , getting errors when trying detect inputs.
error follows:-
code: select all
3: 0 connected result code 0 traceback (most recent call last): file "./centralcontrol.py", line 176, in <module> if mcp1.input(14) == false: file "/root/gardencontrol/adafruit_mcp230xx.py", line 119, in input assert self.direction & (1 << pin) != 0, "pin %s not set input" % pin assertionerror: pin 14 not set input
code: select all
# main program loop client = mqtt.client() client.on_connect = on_connect client.on_message = on_message client.connect("monique.linaus.int", 1883, 60) client.loop_start() fountainontime=0 fountainonamount=900 print "%d: %x" % (3, mcp1.input(14) >> 3) while true: # test button being on if mcp1.input(15) == false: client.publish("device/garden/a1", "on") fountainontime=time.time() # switch pump off if 15 minutes has elapsed if time.time>(float(fountainontime) + float(fountainonamount)): client.publish("device/garden/a1", "off") #ensure pond has enough water if mcp1.input(14) == false: client.publish("device/garden/b1", "on") #switch off pump if water way low if mcp1.input(13) == false: client.publish("device/garden/a1", "off")
mcp1 defined using mcp23017 library adafruit , client.publish paho mqtt library.
in advance,
liveitnerd
should show gpio / mcp library initialisation code - how mcp1 object instantiated before calling mcp1.input(14)?
raspberrypi
Comments
Post a Comment