{"id":16516663,"url":"https://github.com/eadf/esp8266_mcp23017_example","last_synced_at":"2025-07-26T21:10:24.058Z","repository":{"id":26736381,"uuid":"30194001","full_name":"eadf/esp8266_mcp23017_example","owner":"eadf","description":"Demo of an I²C port expander driver for esp8266","archived":false,"fork":false,"pushed_at":"2015-03-13T18:41:22.000Z","size":456,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-02T18:19:36.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eadf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-02T15:41:40.000Z","updated_at":"2020-12-11T16:00:29.000Z","dependencies_parsed_at":"2022-07-14T01:20:28.182Z","dependency_job_id":null,"html_url":"https://github.com/eadf/esp8266_mcp23017_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eadf/esp8266_mcp23017_example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eadf%2Fesp8266_mcp23017_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eadf%2Fesp8266_mcp23017_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eadf%2Fesp8266_mcp23017_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eadf%2Fesp8266_mcp23017_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eadf","download_url":"https://codeload.github.com/eadf/esp8266_mcp23017_example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eadf%2Fesp8266_mcp23017_example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267236747,"owners_count":24057656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T16:25:59.209Z","updated_at":"2025-07-26T21:10:24.033Z","avatar_url":"https://github.com/eadf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp8266_mcp23017_example\n\nI²C Port expander [driver](https://github.com/eadf/esp8266_mcp23017) example for esp8266. It connects to the mcp2307 with two GPIO pins of your own choice.\n\nThe API is very arduino:like, here is the mandatory blinky example:\n```\n#include \"mcp23017/mcp23017.h\"\n....\n// setup\nMCP23017_Self mcpSelf;  // in lieu of C++ member data we have structs :)\nuint8_t deviceAddr=0;\nuint8_t aMcpPin = 2; // the pin on the mcp23017 we want to write to\ni2c_master_gpio_init(); // uses the pins defined by I2C_MASTER_SDA_GPIO \u0026 I2C_MASTER_SCL_GPIO\ni2c_master_init();  \nmcp23017_init(\u0026mcpSelf);\nmcp23017_pinMode(\u0026mcpSelf, deviceAddr, aMcpPin, MCP23017_OUTPUT);\n\n....\n\n// loop\nmcp23017_digitalWrite(\u0026mcpSelf, deviceAddr, aMcpPin, 0);\ndelay\nmcp23017_digitalWrite(\u0026mcpSelf, deviceAddr, aMcpPin, 1);\ndelay\n  ```\n  \nYou can access the bits one by one like above, by whole bytes or all the bits at once (uint16_t).\n\nThe I²C driver is an extended version of the IoT demo i2c_master driver.\n\nWhile the rest of the MCP23017 driver is a heavily modified port of [Adafruit-MCP23017-Arduino-Library](https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library).\n\n### Todo\n\n* interrupt support. I don't need this so it won't happend unless someone requests it.\n\n\n### Basic test\nI've added a very basic, basic test into the demo.\nTo use this test you should connect each output pin of the\nmcp23017 to corresponding pin on the 'other side' via a 10+K resistor.\n\n left side pin | via | right side pin\n --------------|-----|---------------\n  (bit8)  GPBO |10KOhm | GPA7  (bit7)\n  (bit9)  GPB1 |10KOhm | GPA6  (bit6)\n  (bit10) GPB2 | 10KOhm | GPA5  (bit5)\n  (bit11) GPB3 | 10KOhm | GPA4  (bit4)\n  (bit12) GPB4 |10KOhm | GPA3  (bit3)\n  (bit13) GPB5 | 10KOhm | GPA2  (bit2)\n  (bit14) GPB6 | 10KOhm | GPA1  (bit1)\n  (bit15) GPB7 | 10KOhm | GPA0  (bit0)\n \n Hopefully you should see the text ```all tests passed``` in the console.\n \n# License \n\nGNU GENERAL PUBLIC LICENSE Version 3\n\nThe makefile is copied from [esp_mqtt.](https://github.com/tuanpmt/esp_mqtt)\n\n###Building and installing:\n\nFirst you need to install the sdk and the easy way of doing that is to use [esp_open_sdk.](https://github.com/pfalcon/esp-open-sdk)\n\nYou can put that anywhere you like (/opt/local/esp-open-sdk, /esptools etc etc)\n\nThen you could create a small ```setenv.sh``` file, containing the location of your newly compiled sdk and other platform specific info;\n```\nexport SDK_BASE=/opt/local/esp-open-sdk/sdk\nexport PATH=${SDK_BASE}/../xtensa-lx106-elf/bin:${PATH}\nexport ESPPORT=/dev/ttyO0  \n```\n(or setup your IDE to do the same)\n\nTo make a clean build, flash and connect to the esp console you just do this in a shell:\n```\nsource setenv.sh # This is only needed once per session\nmake clean \u0026\u0026 make test\n```\n\nYou won't be needing esptool, the makefile only uses esptool.py (provided by [esp_open_sdk](https://github.com/pfalcon/esp-open-sdk))\n\nI have tested this with sdk v0.9.5 and v0.9.4 (linux \u0026 mac)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feadf%2Fesp8266_mcp23017_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feadf%2Fesp8266_mcp23017_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feadf%2Fesp8266_mcp23017_example/lists"}