Cloud4RPi
Published

Getting MicroPython on a Sonoff Smart Switch

How to flash MicroPython on a Sonoff Smart Switch to prepare for communication with Cloud4RPi service.

EasyFull instructions provided778
Getting MicroPython on a Sonoff Smart Switch

Things used in this project

Hardware components

Sonoff Wifi
Itead Sonoff Wifi
×1
Pmod USBUART
Digilent Pmod USBUART
×1

Software apps and online services

MicroPython
Cloud4RPi
Cloud4RPi

Story

Read more

Code

Code snippet #13

Plain text
import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.scan()                             # Scan for available access points
sta_if.connect("<AP_name>", "<password>") # Connect to an AP
sta_if.isconnected()                      # Check for successful connection
# Change name/password of ESP8266's AP:
ap_if = network.WLAN(network.AP_IF)
ap_if.config(essid="<AP_NAME>", authmode=network.AUTH_WPA_WPA2_PSK, password="<password>")

Code snippet #14

Plain text
import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.scan()                             # Scan for available access points
sta_if.connect("<AP_name>", "<password>") # Connect to an AP
sta_if.isconnected()                      # Check for successful connection
# Change name/password of ESP8266's AP:
ap_if = network.WLAN(network.AP_IF)
ap_if.config(essid="<AP_NAME>", authmode=network.AUTH_WPA_WPA2_PSK, password="<password>")

Code snippet #15

Plain text
Control commands:
  CTRL-A        -- on a blank line, enter raw REPL mode
  CTRL-B        -- on a blank line, enter normal REPL mode
  CTRL-C        -- interrupt a running program
  CTRL-D        -- on a blank line, do a soft reset of the board
  CTRL-E        -- on a blank line, enter paste mode

Code snippet #16

Plain text
Control commands:
  CTRL-A        -- on a blank line, enter raw REPL mode
  CTRL-B        -- on a blank line, enter normal REPL mode
  CTRL-C        -- interrupt a running program
  CTRL-D        -- on a blank line, do a soft reset of the board
  CTRL-E        -- on a blank line, enter paste mode

Github

https://github.com/espressif/esptool

Credits

Cloud4RPi

Cloud4RPi

3 projects • 9 followers
Cloud control panel for your IoT projects
Contact

Comments

Add projectSign up / Login