I am attempting to interface a MCP23017 to the Raspberry Pi using C code. I can communicate with the device using Linux i2c-tools commands icset and icget.
The problem is that I'm having difficulty finding C code that I can understand that will do the same thing. The code needs to let me specify the register that I read or write to using a variable. I have seen simple code that interfaces with a PCF8574 but it doesn't seem to let me specify the register that I am communicating to within the device.
Paul
-
- Posts: 10
- Joined: Mon Dec 08, 2014 5:30 am
- DougieLawson
- Posts: 40789
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: MCP23017 I2C C Code
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Re: MCP23017 I2C C Code
More specifically, http://wiringpi.com/extensions/i2c-mcp23008-mcp23017/
-
- Posts: 10
- Joined: Mon Dec 08, 2014 5:30 am
Re: MCP23017 I2C C Code
Thanks,
I'm having a problem with header locations. My program is in ...programming/i2c
I use the -lwiringPi option at the end of the compile line. I get a compile error cannot find -lwiringPi.
I'm somewhat new to C and have also tried to locate copies of the wiringPi.h and mcp23017.h files in /usr/local/include
That doesn't work either.
I'm having a problem with header locations. My program is in ...programming/i2c
I use the -lwiringPi option at the end of the compile line. I get a compile error cannot find -lwiringPi.
I'm somewhat new to C and have also tried to locate copies of the wiringPi.h and mcp23017.h files in /usr/local/include
That doesn't work either.
- DougieLawson
- Posts: 40789
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: MCP23017 I2C C Code
Have you installed wiringPi? It's not a built-in component.
http://wiringpi.com/download-and-install/
http://wiringpi.com/download-and-install/
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.