Skip to content

Instantly share code, notes, and snippets.

@aerialist
Created January 27, 2020 05:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aerialist/528b47c0cd827ecf1e1a484bc77f5289 to your computer and use it in GitHub Desktop.
Save aerialist/528b47c0cd827ecf1e1a484bc77f5289 to your computer and use it in GitHub Desktop.
W600-PICO MicroPython
__ __
\ \ /\ / /
\ \ / \ / /
\ \/ /\ \/ /
\ / \ /
/ /\ / /\
/ /\ \/ /\ \
/ / \ / \ \
/_/ \/ \_\
MicroPython v1.10-282-g6a9b3cb-dirty on 2019-09-17; WinnerMicro module with W600
Type "help()" for more information.
>>> help()
Welcome to MicroPython on the W600!
For generic online docs please visit http://docs.micropython.org/
For access to the hardware use the 'machine' module:
import machine
pb26 = machine.Pin(machine.Pin.PB_26, machine.Pin.OUT, machine.Pin.PULL_DOWN)
pb26.value(1)
pb27 = machine.Pin(machine.Pin.PB_27, machine.Pin.IN, machine.Pin.PULL_UP)
print(pb27.value())
Basic WiFi configuration:
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
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
For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')
>>> help('modules')
__main__ gc re ujson
_boot hashlib select uos
_onewire heapq socket urandom
_thread io struct ure
array json sys uselect
binascii machine time usocket
builtins math ubinascii ustruct
cmath micropython ucollections utime
collections network uctypes utimeq
ds18x20 ntptime uerrno uzlib
easyw600 onewire uhashlib w600
errno os uheapq zlib
framebuf random uio
Plus any modules on the filesystem
>>> import easyw600
>>> help(easyw600)
object <module 'easyw600'> is of type module
closeap -- <function closeap at 0x20018f60>
disconnect -- <function disconnect at 0x20018f20>
binascii -- <module 'ubinascii'>
ftpserver -- <function ftpserver at 0x20018f70>
w600 -- <module 'w600'>
oneshot -- <function oneshot at 0x20018ec0>
__name__ -- easyw600
utime -- <module 'utime'>
connect -- <function connect at 0x20018ee0>
createap -- <function createap at 0x20018f40>
scan -- <function scan at 0x20018ea0>
network -- <module 'network'>
>>> import ds18x20
>>> help(ds18x20)
object <module 'ds18x20'> is of type module
const -- <function>
DS18X20 -- <class 'DS18X20'>
__name__ -- ds18x20
>>> help(ds18x20.DS18X20)
object <class 'DS18X20'> is of type type
__init__ -- <function __init__ at 0x200190e0>
convert_temp -- <function convert_temp at 0x200190f0>
scan -- <function scan at 0x200190d0>
__qualname__ -- DS18X20
read_scratch -- <function read_scratch at 0x20019120>
write_scratch -- <function write_scratch at 0x20019130>
read_temp -- <function read_temp at 0x20019140>
__module__ -- ds18x20
>>> import w600
>>> help(w600)
object <module 'w600'> is of type module
__name__ -- w600
flash_read -- <function>
flash_write -- <function>
flash_erase -- <function>
flash_id -- <function>
flash_size -- <function>
flash_user_start -- <function>
run_ftpserver -- <function>
version -- <function>
@aerialist
Copy link
Author

start by

screen /dev/cu.wchusbserial14310 115200

kill it by
Ctr + a, k

@aerialist
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment