树莓派Raspberry Pico W折腾记录

固件刷入

https://micropython.org/download/RPI_PICO/

PICO WIFI版:

https://micropython.org/download/RPI_PICO_W/

按住Boot后供电后,电脑本地磁盘多出RPI2盘符把最新固件拖入即刷入,后自动重启。

PyCharm配置

插件安装:MicroPython,在设备管理器查看设备端口

测试

from machine import Pin
import utime

if __name__ == '__main__':
    # 构建led对象
    # 板载LED灯连接与引脚25相连
    # LED = Pin(id, mode, pull)
    # id:PICO引脚编号
    # mode:输入输出方式,有Pin.IN(输入)和Pin.OUT(输出)两种
    # pull:上下拉电阻配置,有None(无上下拉电阻)、Pin.PULL_UP(上拉电阻)和Pin.PULL_DOWN(下拉电阻)三种
    LED = Pin(25, Pin.OUT)
    # 高电平点亮
    while(True):
       LED.value(1)
       utime.sleep_ms(1000)
       LED.value(0)
       utime.sleep_ms(1000)

功能实现

SG90舵机运行

https://github.com/ColorfulGhost/pico-w-mqtt-sg90

运行串口报错重置闪存

需要nuke.uf2

https://github.com/thonny/thonny/issues/2513

https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#resetting-flash-memory

参考文档:

https://blog.csdn.net/weixin_40330033/article/details/117430765

https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html