{"id":13613469,"url":"https://github.com/ShrimpingIt/micropython-mcp230xx","last_synced_at":"2025-04-13T15:33:10.446Z","repository":{"id":56544072,"uuid":"96227975","full_name":"ShrimpingIt/micropython-mcp230xx","owner":"ShrimpingIt","description":"Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx","archived":false,"fork":false,"pushed_at":"2021-10-21T13:54:15.000Z","size":55,"stargazers_count":30,"open_issues_count":5,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-07T21:42:14.547Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShrimpingIt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-04T14:44:21.000Z","updated_at":"2023-12-07T10:29:00.000Z","dependencies_parsed_at":"2022-08-15T20:40:29.604Z","dependency_job_id":null,"html_url":"https://github.com/ShrimpingIt/micropython-mcp230xx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShrimpingIt%2Fmicropython-mcp230xx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShrimpingIt%2Fmicropython-mcp230xx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShrimpingIt%2Fmicropython-mcp230xx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShrimpingIt%2Fmicropython-mcp230xx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShrimpingIt","download_url":"https://codeload.github.com/ShrimpingIt/micropython-mcp230xx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248736182,"owners_count":21153545,"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","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-08-01T20:00:47.902Z","updated_at":"2025-04-13T15:33:10.135Z","avatar_url":"https://github.com/ShrimpingIt.png","language":"Python","funding_links":[],"categories":["精选驱动库","Libraries"],"sub_categories":["功能类","IO"],"readme":"# micropython-mcp230xx\n\nMicropython I2C-based manipulation of the MCP series GPIO expanders MCP23017 and MCP23008, derived from the Adafruit_MCP230xx.py module of https://github.com/adafruit/Adafruit_Python_GPIO\n\nThis has been tested with ESP8266 running Micropython 1.8.7 on MCP23017 only, but hopefully works also for MCP23008 if you have one. Please post an issue if you have success.\n\nTo use, wire up the GPIO expander chip following this loom...\n\n* MCP23017 Pins \n    * 9 =\u003e 3.3V supply\n    * 10 =\u003e GND\n    * 12 =\u003e ESP8266 GPIO5 (NodeMCU D1) [I2C SCL Signal]\n    * 13 =\u003e ESP8266 GPIO3 (NodeMCU D2) [I2C SDA Signal]\n    * 12 =\u003e 10kOhm resistor =\u003e 3.3V Supply [I2C SCL Pull-up]\n    * 13 =\u003e 10kOhm resistor =\u003e 3.3V Supply [I2C SDA Pull-up]\n    * 18 =\u003e 10kOhm resistor =\u003e 3.3V Supply [Reset pin in 'run' configuration]\n    \nAlso choose the address of each MCP23017, e.g.\n\n* Addressing pins for address 0x20\n   * 15 =\u003e 10kOhm resistor =\u003e GND\n   * 16 =\u003e 10kOhm resistor =\u003e GND\n   * 17 =\u003e 10kOhm resistor =\u003e GND\n\nThe mappings between pins and I2C addresses are...\n\n![Pin pull table](http://raspi.tv/wp-content/uploads/2013/07/MCP23017-addresspins1.jpg) \n\nIf you wish to use a different I2C address, or a different GPIO-numbered SDA or SCL pin than the default then pass that in to the constructor. \n\nThe default constructor arguments mean that MCP23017() is equivalent to MPC23017(address=0x20, gpioScl=5, gpioSda=4).\n\nA handy visual reference is this from mathworks, although I recommend that for ESP8266 the chip power should be provided by 3.3V not 5V, to make sure logic levels are correct and that the serial data line doesn't overload SDA.\n\n![MCP Pinout](https://www.mathworks.com/help/examples/raspberrypiio_product/win64/mcp23017_circuit.png)\n\nFor example, the following will set the output values of pins 10-15 and read the logic value (True or False) of pins 0-9\n\n```python\nimport mcp\n\nio = mcp.MCP23017()\n\n# controls some output pins\noutPins = list(range(10,16))\nnextVals = {}\nfor pinNum in outPins:\n    io.setup(pinNum, mcp.OUT)\n    nextVals[pinNum] = True\nio.output_pins(nextVals)\n\n# monitors and prints some input pins\ninPins = list(range(0,10))\nfor pinNum in inPins:\n    io.setup(pinNum, mcp.IN)\nwhile True:\n    print(io.input_pins(inPins))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShrimpingIt%2Fmicropython-mcp230xx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShrimpingIt%2Fmicropython-mcp230xx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShrimpingIt%2Fmicropython-mcp230xx/lists"}