asp做的网站频繁报错 参数错误,宁波网站制作哪家强,静态网站开发实验报告,页面模板功能raspberry pico w引脚图
1. 准备工作
板子编辑器raspberry pico wmicropython#xff08;thonny编辑器#xff09;
最新的raspberry pi pico w系统包下载地址。
点亮板载led灯
需要注意的是pico的板载led灯是GPIO25引脚#xff0c;picow的板子led灯则直接用Pin包的thonny编辑器
最新的raspberry pi pico w系统包下载地址。
点亮板载led灯
需要注意的是pico的板载led灯是GPIO25引脚picow的板子led灯则直接用Pin包的LED来索引。
import machine
import time# user led is LED
led machine.Pin(LED, machine.Pin.OUT)while True:led.on()time.sleep(0.5)led.off()time.sleep(0.5)如果用led等直连到GP1和GND之间则代码只需要简单修改led machine.Pin(GP1, machine.Pin.OUT)即可。
2. 驱动直流电机
这里使用DRV8833模块 我这里使用的接线
picowDRV8833DRV8833MotorGP16AIN1AO1motorA2GP17AIN2AO2motorA1GP18BIN1BO1motorB1GP19BIN2BO2motorB2VM接6V电池3V驱动不了GNDGNDGP20STBY置0则清空所有输出
示例代码每2s间隔后电机旋转2s。
import time
from machine import PinSTBY Pin(20, Pin.OUT)
STBY.value(1)motor_A1 Pin(17, Pin.OUT)
motor_A2 Pin(16, Pin.OUT)motor_B1 Pin(18, Pin.OUT)
motor_B2 Pin(19, Pin.OUT)while True:motor_A1.value(0)motor_A2.value(1)motor_B1.value(1)motor_B2.value(0)time.sleep(2)motor_A1.off()motor_A2.off()motor_B1.off()motor_B2.off()time.sleep(2)实物图