「Raspberry pico w」:修訂間差異

出自TSK WIKI
跳至導覽 跳至搜尋
第5行: 第5行:
*[https://www.youtube.com/watch?v=Lwr8LLvLRb8 Feel the noise on a Raspberry Pi Pico - learn to play .wav and .mp3 files in CircuitPython]
*[https://www.youtube.com/watch?v=Lwr8LLvLRb8 Feel the noise on a Raspberry Pi Pico - learn to play .wav and .mp3 files in CircuitPython]
**[https://drive.google.com/drive/folders/1VkvuRZguE6g79imw_4XpzSaFeeDjCHxR circuitpython-school-files]
**[https://drive.google.com/drive/folders/1VkvuRZguE6g79imw_4XpzSaFeeDjCHxR circuitpython-school-files]
==學習方向==
*wifi連網
*http
*mp3player 用來撥放米數音檔
** GPIO14 + GND to SOCKET
*Barcord scaner
**bluetooth
**usb
*MQTT publisher
*WS2812B LED燈條驅動
**neopixel
*外接電源


==mp3 player==
==mp3 player==

於 2024年1月5日 (五) 14:35 的修訂

參考資料

學習方向

  • wifi連網
  • http
  • mp3player 用來撥放米數音檔
    • GPIO14 + GND to SOCKET
  • Barcord scaner
    • bluetooth
    • usb
  • MQTT publisher
  • WS2812B LED燈條驅動
    • neopixel
  • 外接電源

mp3 player

<python> import board, digitalio from audiomp3 import MP3Decoder from audiopwmio import PWMAudioOut as AudioOut

audio = AudioOut(board.GP14) path = "sounds/"

filename = "1.mp3" mp3_file = open(path + filename, "rb") decoder = MP3Decoder(mp3_file)

def play_mp3(filename):

   decoder.file = open(path + filename, "rb")
   audio.play(decoder)
   while audio.playing:
       pass

play_mp3("1.mp3")

</python>

LED blink

<python> from machine import Pin import time

led = Pin("LED", Pin.OUT)

while True:

 led.on()   # LED亮
 time.sleep(1)  # 等待1秒
 led.off()
 time.sleep(1)  # LED滅

</python>

連上wifi

<python> import network import time

  1. 配置您的WiFi连接信息

ssid = 'QCRD' password = 'tskdenko'

  1. 初始化WiFi接口

wlan = network.WLAN(network.STA_IF)

  1. 激活接口

wlan.active(True)

  1. 连接到WiFi网络

if not wlan.isconnected():

   print('正在连接到网络...')
   wlan.connect(ssid, password)
   # 等待连接
   while not wlan.isconnected():
       pass
  1. 显示网络接口的状态

print('网络配置:', wlan.ifconfig()) </python>