Last active
November 2, 2018 23:19
-
-
Save malefs/7233d00ae4333b2d81d23680c314e557 to your computer and use it in GitHub Desktop.
micropython circuitpython esp8266 esp32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pip install esptool | |
| esptool.py --port com14 erase_flash | |
| esptool.py --port com14 --baud 460800 write_flash --flash_size=detect 0 adafruit-circuitpython-feather_huzzah-3.0.1.bin | |
| esptool.py --port com14 --baud 115200 write_flash --verify --flash_mode=qio --flash_size=detect 0 adafruit-circuitpython-feather_huzzah-3.0.1.bin | |
| Firmware: | |
| http://micropython.org/download#esp8266 | |
| https://github.com/adafruit/circuitpython/releases | |
| Putty connect serial 115200 | |
| REPL: | |
| Adafruit CircuitPython 3.0.1 on 2018-08-21; ESP module with ESP8266 | |
| Press any key to enter the REPL. Use CTRL-D to soft reset. | |
| >>> | |
| Ctrl-A on a blank line will enter raw REPL mode. This is like a permanent paste mode, except that characters are not echoed back. | |
| Ctrl-B on a blank like goes to normal REPL mode. | |
| Ctrl-C cancels any input, or interrupts the currently running code. | |
| Ctrl-D on a blank line will do a soft reset. | |
| ctrl-E will special paste mode | |
| Note that ctrl-A and ctrl-D do not work with WebREPL. | |
| import esp | |
| esp.check_fw() | |
| import webrepl_setup | |
| E ->enable on boot | |
| set passwort | |
| y ->reboot | |
| WEB-Console REPL | |
| verbinden mit ESP-Accespoint <<Micropython-14dbe7>> | |
| WPA Passwort:micropythoN | |
| Download Webrepl: | |
| https://github.com/micropython/webrepl/archive/master.zip | |
| start webrepl.html | |
| oder wenn Netzwerk vorhanden: | |
| http://micropython.org/webrepl/ | |
| --- | |
| Verbindung mit vorhandenem Netzwerk | |
| im Serial Repl: | |
| import network | |
| wlan = network.WLAN(network.STA_IF) | |
| wlan.active(True) | |
| wlan.connect('ssid', 'password') | |
| wlan.ifconfig() | |
| import webrrepl | |
| webrepl.start() | |
| in boot.py | |
| def do_connect(): | |
| import network | |
| sta_if = network.WLAN(network.STA_IF) | |
| if not sta_if.isconnected(): | |
| print('connecting to network...') | |
| sta_if.active(True) | |
| sta_if.connect('<essid>', '<password>') | |
| while not sta_if.isconnected(): | |
| pass | |
| print('network config:', sta_if.ifconfig()) | |
| ---- | |
| #boot.py | |
| from network import WLAN | |
| import os | |
| import time | |
| # | |
| # Set up WLAN | |
| # | |
| wlan = WLAN() # get current object, without changing the mode | |
| ssid = 'YOUR_SSID' | |
| password = 'YOUR_WIFI_PASSWORD' | |
| ip = 'YOUR_STATIC_IP_ADDRESS' | |
| net_mask = 'YOUR_NETMASK' | |
| gateway = 'YOUR_GATEWAY_IP_ADDRESS' | |
| dns = 'YOUR_DNS_SERVER' | |
| def init(): | |
| wlan.init(WLAN.STA) | |
| wlan.ifconfig(config=(ip, net_mask, gateway, dns)) | |
| def connect(): | |
| wlan.connect(ssid, auth=(WLAN.WPA2, password), timeout=5000) | |
| while not wlan.isconnected(): | |
| machine.idle() # save power while waiting | |
| cfg = wlan.ifconfig() | |
| print('WLAN connected ip {} gateway {}'.format(cfg[0], cfg[2])) | |
| def set(): | |
| init() | |
| if not wlan.isconnected(): | |
| connect() | |
| ---- | |
| ----- | |
| disable debug: | |
| import esp | |
| esp.osdebug(None) | |
| ---- | |
| #Dokumentation: | |
| https://test-circuitpython.readthedocs.io/en/again-docs/docs/esp8266/quickref.html | |
| https://test-circuitpython.readthedocs.io/en/again-docs/index.html | |
| https://docs.micropython.org/en/latest/esp8266/quickref.html | |
| https://learn.adafruit.com/category/micropython-slash-circuitpython?guide_page=3 | |
| import network | |
| wlan = network.WLAN(network.STA_IF) # create station interface | |
| wlan.active(True) # activate the interface | |
| wlan.scan() # scan for access points | |
| wlan.isconnected() # check if the station is connected to an AP | |
| wlan.connect('essid', 'password') # connect to an AP | |
| wlan.config('mac') # get the interface's MAC adddress | |
| wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses | |
| ap = network.WLAN(network.AP_IF) # create access-point interface | |
| ap.active(True) # activate the interface | |
| ap.config(essid='ESP-AP') # set the ESSID of the access point | |
| Blinky: | |
| import machine | |
| WEMOS D1 | |
| led = machine.Pin(2, machine.Pin.OUT) | |
| led.value(1) | |
| #upload code | |
| pip install adafruit-ampy | |
| ampy ls get mkdir put reset run rmdir get --no-output | |
| ampy --port com14 put main.py main.py | |
| ampy -p com14 put dir lib/dir #copy directory with files to | |
| circuitpython librarys | |
| https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment