Page 1 of 1
MCP23017 INPUT
Posted: Fri Mar 10, 2023 7:31 am
by zoli2496
Good afternoon!
How to configure MCP23017 macro to act as an input? I would like to connect 3 push buttons to port A GPA0-GPA1-GPA2.
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 8:29 am
by medelec35
Hello.
What version of Flowcode are you using?
When starting a new topic, we recommend using either a 9 or 10 post icon when the post is specific to a version of Flowcode.
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 9:04 am
by BenR
Hello,
Just call the read function with the appropriate port index and mask and the data direction will be done for you.
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 9:17 am
by zoli2496
Hello
I use Flowcode v9. The output already works with the MCP23017, but the input does not. I want to use only certain inputs from the MCP ic, with a push button. If I press the button, the value of the corresponding variable should be 0 or 1. This is what I want to achieve.
I have attached pictures.
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 9:18 am
by zoli2496
more picture
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 9:48 am
by medelec35
Hello.
Does reading the port work?
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 10:24 am
by zoli2496
Only "DF_PLAYER" works, "VOL_UP" and "VOL_DOWN" do not work. Also, the value of "VOL_DOWN" is constantly 1. (no button is pressed, the value of "VOL_DOWN" is still 1.) It does not respond to "VOL_UP".
Re: MCP23017 INPUT
Posted: Fri Mar 10, 2023 11:03 am
by medelec35
One thing I have noticed.
With
you have got OR which is a bitwise OR operator.
Can you try with
|| which is a logical OR operator.
| is the pipe key which is usually on the same key as the backslash \
Have you measured the voltage directly on the MCP23017 input pins to check the hardware?