{"id":21880992,"url":"https://github.com/apoclyps/micropython-by-example","last_synced_at":"2026-04-13T12:31:51.340Z","repository":{"id":39641929,"uuid":"162930893","full_name":"apoclyps/micropython-by-example","owner":"apoclyps","description":"A gentle introduction to Micropython using a ESP8266","archived":false,"fork":false,"pushed_at":"2023-03-02T01:09:07.000Z","size":380,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T00:44:36.556Z","etag":null,"topics":["esp8266","mcu","micropython"],"latest_commit_sha":null,"homepage":"https://apoclyps.github.io/micropython-by-example/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apoclyps.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-23T23:26:21.000Z","updated_at":"2021-12-13T22:17:48.000Z","dependencies_parsed_at":"2025-03-22T00:43:38.159Z","dependency_job_id":"3722cfe1-33b0-4a09-b591-d90748b42f8b","html_url":"https://github.com/apoclyps/micropython-by-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/apoclyps/micropython-by-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apoclyps%2Fmicropython-by-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apoclyps%2Fmicropython-by-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apoclyps%2Fmicropython-by-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apoclyps%2Fmicropython-by-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apoclyps","download_url":"https://codeload.github.com/apoclyps/micropython-by-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apoclyps%2Fmicropython-by-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31753081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["esp8266","mcu","micropython"],"created_at":"2024-11-28T09:17:12.965Z","updated_at":"2026-04-13T12:31:51.318Z","avatar_url":"https://github.com/apoclyps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Micropython (ESP8622) By Example\n================================\n\n\u003e MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"308\" height=\"260\" src=\"images/nodemcu_pins.png\"\u003e\n\u003c/p\u003e\n\n### Prerequisites\n\n- [Python](https://www.python.org/downloads/)\n- [Pipenv](https://pipenv.readthedocs.io/en/latest/)\n- [nodemcu-firmware](https://github.com/nodemcu/nodemcu-firmware/releases)\n- [Micropython 1.9.4](https://micropython.org/download#esp8266)\n- [Putty](https://www.putty.org/)\n- [uPyCraft](https://dfrobot.gitbooks.io/upycraft/content/)\n\n### Install Drivers and Identify COM port\n\nInstall the official [nodemcu-devkit drivers](https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers) for your OS.\n\n### Flashing the ESP8266 MCU\n\nFirstly, erase the flash memory on the MCU. Memory is typically limited to a few megabytes.\n\n```sh\nesptool --port COM3 -c esp8266 --baud 460800 erase_flash\n```\n\nWrite the firmware to the devices flash storage\n\n```sh\nesptool --port COM3 -c esp8266 --baud 460800 write_flash --flash_size=detect 0 esp8266-20180511-v1.9.4.bin\n```\n\n### Connect to ESP8266 via Putty\n\nCreate a serial connection on your COM port with the correct baud rate:\n\n- Serial Line: COM3\n- Speed: 115200\n\nA successful connection will yield a python REPL\n\n### MicroPython REPL\n\nRun the following in the REPL to evaluate the device is working correctly:\n\n```python\nfrom machine import Pin\n\n# GPIO16 (D0) is the internal LED for NodeMCU\nled_red = Pin(16, Pin.OUT)\n# SETS the pin state to HIGH\nled_blue.value(0)\n# SETS the pin state to LOW\nled_blue.value(1)\n```\n\n### Copying files to the Flash Storage\n\nTo use `ampy` directly, you will need to run `pipenv install` and `pipenv shell`.\n\nList all files within flash storage:\n\n```sh\nampy -d 0.5 -p COM3 ls\n```\n\nRead the contents of a file from flash storage:\n\n```sh\nampy -d 0.5 -p COM3 get boot.py\n```\n\nCopy file to flash storage at the root directory:\n\n```sh\nampy -d 0.5 -p COM3 put examples/blink.py\n```\n\nRemove file from flash storage:\n\n```sh\nampy -d 0.5 -p COM3 rm blink.py\n```\n\n### Running a program on device boot\n\n`boot.py` will run as a precursor to `main.py`. Creating a `main.py` will run every time the device is powered on.\n\n```\ntouch main.py\n# add contents to main.py\nampy -d 0.5 -p COM3 put main.py\n```\n\n### Development\n\nSelect your favorite IDE or editor for Python and develop your project. Once you are ready to run the code on a ESP8266, you can use uPyCraft to easily copy across the files to the device and open a REPL.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"450\" height=\"300\" src=\"images/upycraft.png\"\u003e\n\u003c/p\u003e\n\n### Resources\n\n- [DHT (Digital Humidity \u0026 Temperature) sensors](https://docs.micropython.org/en/latest/esp8266/tutorial/dht.html)\n- [Networking (Wi-Fi)](https://docs.micropython.org/en/latest/esp8266/quickref.html#networking)\n\n### Maintainer\n\nIf you want to contact me, check out my twitter account, find me on #apoclyps.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapoclyps%2Fmicropython-by-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapoclyps%2Fmicropython-by-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapoclyps%2Fmicropython-by-example/lists"}