又见炊烟升起

导航

=Quick reference card - 掌控板

硬件

//掌控板
image

//扩展板
image

image

引脚 类型 描述
P0 I/O 模拟/数字输入,模拟/数字输出,TouchPad
P1 I/O 模拟/数字输入,模拟/数字输出,TouchPad
P2 I 模拟/数字输入
P3 I 模拟/数字输入,连接掌控板EXT鳄鱼夹,可连接阻性传感器
P4 I 模拟输入/数字输入,连接掌控板光线传感器
P5 I/O 数字输入,模拟/数字输出, 连接掌控板按键A,neopixel
P6 I/O 数字输入,模拟/数字输出, 连接掌控板蜂鸣器,不使用蜂鸣器时,可以作为数字IO使用,neopixel
P7 I/O 数字输入,模拟/数字输出, 连接掌控板RGB LED
P8 I/O 数字输入,模拟/数字输出,neopixel
P9 I/O 数字输入,模拟/数字输出,neopixel
P10 I 模拟/数字输入,连接掌控板声音传感器
P11 I/O 数字输入,模拟/数字输出, 连接掌控板按键B,neopixel
P12 I/O 保留
P13 I/O 数字输入,模拟/数字输出,neopixel
P14 I/O 数字输入,模拟/数字输出,neopixel
P15 I/O 数字输入,模拟/数字输出,neopixel
P16 I/O 数字输入,模拟/数字输出,neopixel
3V3 POWER 电源正输入:连接USB时,掌控板内部稳压输出3.3V,未连接USB可以通过输入(2.7-3.6)V电压为掌控板供电
P19 I/O 数字输入,模拟/数字输出,I2C总线SCL,与内部的OLED和加速度传感器共享I2C总线,neopixel
P20 I/O 数字输入,模拟/数字输出,I2C总线SDA,与内部的OLED和加速度传感器共享I2C总线,neopixel
GND GND 电源GND
Touch_P(P23) I/O TouchPad
Touch_Y(P24) I/O TouchPad
Touch_T(P25) I/O TouchPad
Touch_H(P26) I/O TouchPad
Touch_O(P27) I/O TouchPad
Touch_N(P28) I/O TouchPad

开机日志


ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4300
load:0x40078000,len:12740
load:0x40080400,len:3248
entry 0x40080610
=$%#=
=$%#=
=$%#=
MicroPython v2.4.0-2-g3651c21 on 2023-07-26; mpython with ESP32
Type "help()" for more information.
>>> help()
Welcome to MicroPython on the ESP32!

For generic online docs please visit http://docs.micropython.org/

For access to the hardware use the 'machine' module:

import machine
pin12 = machine.Pin(12, machine.Pin.OUT)
pin12.value(1)
pin13 = machine.Pin(13, machine.Pin.IN, machine.Pin.PULL_UP)
print(pin13.value())
i2c = machine.I2C(scl=machine.Pin(21), sda=machine.Pin(22))
i2c.scan()
i2c.writeto(addr, b'1234')
i2c.readfrom(addr, 4)

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')
>>> i2c.scan()
[38, 48, 60]
>>>

//掌控板的开机就执行其文件系统根目录的main.py

开发环境

mind+

//打开mind+后,如果直接打开代码,点击"运行",可能会报错,需要安装响应的库,类似如下:

C:\Users\MateBook Xpro>"C:\Users\MateBook Xpro\Documents\mindplus-py\environment\Python3.6.5-64\python.exe" -m pip install --upgrade pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting pip
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 1.1 MB/s
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.6.exe and pip3.exe are installed in 'C:\Users\MateBook Xpro\Documents\mindplus-py\environment\Python3.6.5-64\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.3.1

C:\Users\MateBook Xpro>"C:\Users\MateBook Xpro\Documents\mindplus-py\environment\Python3.6.5-64\python.exe" -m pip install mpython
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting mpython
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/89/c9/636b134923253bccfdeeccff026622a0e32d42e4490ef11e36443b59765e/mpython-1.0.tar.gz (4.7 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for mpython, since package 'wheel' is not installed.
Installing collected packages: mpython
    Running setup.py install for mpython ... done
Successfully installed mpython-1.0

micropython编程API

盛思公司

https://mpythonsoftware.readthedocs.io/zh/latest/blocks/

BXY开发工具

语法和盛思的不兼容,参考
https://bxy.dfrobot.com.cn/mpy-basics

posted on 2023-09-10 20:43  ni_sy  阅读(13)  评论(0编辑  收藏  举报