blemasle / arduino-mcp23017

Complete support of MCP23017
MIT License
71 stars 40 forks source link

Multiple boards on 1 bus #19

Closed PizzaProgram closed 3 years ago

PizzaProgram commented 3 years ago

EDIT: I've realized: YES, this library CAN handle up to 8 of the MCP23017 panels, each with different address.

The Readme.md could be enhanced a tiny bit more to make that clear:

Usage

Unlike most Arduino library, no default instance is created when the library is included. It's up to you to create one with the appropriate chip I2C address. Maximum 8 boards can be attached to one I2C bus. Address goes from (hexa) 0x20 - 0x27

#include <Arduino.h>
#include <MCP23017.h>

MCP23017 mcp1 = MCP23017(0x20);
// ...
MCP23017 mcp8 = MCP23017(0x27);
PizzaProgram commented 3 years ago

Why?

MCP23017 IO Expansion Board

blemasle commented 3 years ago

Hi,

I'll add the available addresses as you suggested, thanks. Although this information is available in the MCP23017 datasheet (linked on the first line of the readme) that in my opinion you will need to read to use this library. The goal is not to have a library that you allow to play with an MCP23017 "at the surface", but rather an extensive control over the chip.

A picture from a board would increase the understandability for beginners what's this about

I have a different perspective on this :) A picture from a board would mislead potential users that this library is about using that board, not the chip itself.

Because it took me more hundreds of hours of searching and learning before I've found this library

The library is the fourth result in the Arduino IDE for "mcp23017", first and second results for "mcp23017 arduino" on duckduckgo and google respectively.

So I cannot see what could be done to made it easier to find, or how what you've suggested would change something about it ¯\(ツ)

while I'm not a student Not sure to get the point here, nor the tone or the implications of this sentence.

PizzaProgram commented 3 years ago

< OFF >

Hi,

I'm happy you liked at least one of my suggestions. ( I've thought I've explained myself good enough and you have realized how I'm trying to help for everyone first opening the main page of this project. )

Although this information is available in the MCP23017 datasheet (linked on the first line of the readme)

The goal would be to be as much informative at the first place as possible and to pass on ALL the important knowledge you guys know. I fully understand, that these things are "obvious" for you, but for us "mortals", it's mostly: "%+÷245˛˘˙1=()" ??? :-D

That's where a few extra lines of code and a few pictures can help really really lot!

There are other half-solutions out there which can NOT handle multiple board on the same bus. Nobody likes to deep-search for info, and nobody will download / fork until realized:

That's all I'm trying to explain:

How do I know?

So a little bit of more documentation can not hurt. We are talking about +4 lines and a picture.

The goal is not to have a library that you allow to play with an MCP23017 "at the surface", but rather an extensive control over the chip

That's fine and I understand! ( Although beginners usually buy a board first, not just a chip. Experts know what to look for... )

while I'm not a student Not sure to get the point here, nor the tone or the implications of this sentence.

I don't know what you mean. Sorry if my english is poor. I've wrote my first program in 1987, but still it's hard for me to understand all these information about IoT I've started to learn about 1 year ago. I can not even imagine how overvelming must be for example: for a student. So I'm trying to suggest how to improve documentation, so others can learn faster. And to advertise this great piece of work ! Because you guys are amazing. :1st_place_medal:

PizzaProgram commented 3 years ago

Do you like this picture better I've created? _montage

blemasle commented 3 years ago

I let this one out. Closing this, as I'm sorry to say I disagree with the initial statement.

This library will require you to read the chip datasheet. If you're not inclined to read a short readme intro and dive into the datasheet, but are rather looking for an image to find what you're looking at, then this library is not what you're looking. You're probably wasting your time and should look for a more high level api. 🙂