0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VS CodeからRaspberry Pi Pico Wを動かす

Last updated at Posted at 2025-05-01

MicroPicoの拡張機能をインストール

VS Codeのサイドバーの拡張機能を選択し、エディットボックスに"MicroPico"と入力し、[インストール]ボタンをクリックする。
Micro_Pico.png

main.pyのファイルを作成し、main.pyの入ったフォルダをVS Codeで開く

Micro_Pico_edit.png

初期化

「ctrl+shift+p または F1」でコマンドパレットを開き、次のコマンドを実行する。
MicroPico: Initialize MicroPico project
すると、左下のツールバーにMicroPicoのアイコンが表示され、main.pyと同じフォルダに.vscodeフォルダが作成されてMicroPicoの設定ファイルが作成される。
Micro_Pico_edit2.png

Pico Wの接続

PCのUSBポートとPico Wを接続すると、MicroPicoのツールバーの「Pico Disconnected」が「Pico Connected」に変化する。
Micro_Pico_Connected.png

プログラムの作成と実行

main.pyに動作確認用のプログラムを入力してMicro_Pico_Run.pngをクリックすると、入力したプログラムがPico Wで実行される。

main.py
import time
from machine import Pin

# Pico Wのonboard LED 
led = Pin("LED", Pin.OUT)
  
#1秒毎に点灯と消灯を繰り返す
while True:
    led.value(1); time.sleep(1); #1秒間点灯
    led.value(0); time.sleep(1); #1秒間消灯

VS CodeからPico Wにプログラムを転送

プログラムをPico Wにアップロードする場合、「ctrl+shift+p または F1」でコマンドパレットを開き、次のコマンドを実行する。
MicroPico: Upload file to Pico

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?