这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » DIY与开源设计 » 电子DIY » 买了一个RaspberryPiPico2试玩

共10条 1/1 1 跳转至

买了一个RaspberryPiPico2试玩

菜鸟
2024-09-07 23:16:52   被打赏 100 分(兑奖)     打赏

安装固件https://micropython.org/download/RPI_PICO2/

from machine import Pin # Import the Pin class from the machine module
from time import sleep  # Import the sleep function from the time module

# Initialize GPIO25 as an output pin, which controls the USER LED
led = Pin(25, Pin.OUT) 

# Turn off the LED initially
led.value(1) # led.on() -> high level -> light off
sleep(0.5) # Wait for 0.5 seconds

# Turn on the LED
led.value(0) # led.off() -> low level -> light on
sleep(0.5) # Wait for 0.5 seconds

# Enter an infinite loop
while True:
    # Toggle the LED state (on to off or off to on)
    led.toggle() 
    # Print the current state of the LED
    print(f"LED {'ON' if led.value() == 0 else 'OFF'}")
    sleep(0.5) # Wait for 0.5 seconds before the next toggle

微信图片_20240907230702.jpg


专家
2024-09-08 00:20:43     打赏
2楼

感谢楼主分享


高工
2024-09-08 06:16:07     打赏
3楼
感谢楼主分享

专家
2024-09-08 11:40:22     打赏
4楼

编程,有库支持,方便多了。开发也会出现分化。


高工
2024-09-08 11:59:00     打赏
5楼

感谢楼主分享


菜鸟
2024-09-09 11:07:50     打赏
6楼

谢谢分享,问下这是一个什么产品?


助工
2024-09-10 09:54:54     打赏
7楼

居然能搞到,现在得捷上都还没货,一直想弄一个玩玩


专家
2024-09-10 10:00:40     打赏
8楼

期待多给大家分享一下哈


菜鸟
2024-09-10 22:07:07     打赏
9楼

好东东鸭!哈哈期待楼主后续分享的内容。


菜鸟
2024-09-12 12:34:47     打赏
10楼

谢谢分享


共10条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]