tinkerspy / Automaton

Reactive State Machine Framework for Arduino
https://github.com/tinkerspy/Automaton/wiki
MIT License
369 stars 63 forks source link

how to use the framework in combination with i2c libraries (mcp23017.h) #83

Open kamerforpresident opened 3 years ago

kamerforpresident commented 3 years ago

Hi @tinkerspy,

First a big thumbs up for the framework! So powerful and well designed. I am just a hobbyist and tinkerer working with i2c devices on arduino / esp8266. I am familiar with C++, but less with the OO part.

I would like to have some clue on how to extend your "atm_button" and "atm_led" components to be used in combination with mcp23017 i2c port extenders. Available libraries offer their own classes and methods to control the pins on the port extenders (connected via i2c bus)

The following library I would like to use the automaton framework: (https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library).

I am working on fun projects like garden irrigation, automated mini railroads and micro beer brewery using arduino and my own state machine coding, which is limited and will heavily benefit from using automaton.

Best (en groeten) Remko

tinkerspy commented 3 years ago

I think I'd just copy the existing atm_led & atm_button classes and create atm_mcp23017_button and atm_mcp23017_led classes. Include the mcp23017 library and modify the code. It shouldn't be too difficult.