LoginSignup
20
13

More than 3 years have passed since last update.

M1 Macで Raspberry Pi PicoのLチカ

Last updated at Posted at 2021-02-05

Raspberry Pi Picoを入手したので、Get Started with MicroPython on Raspberry Pi Picoの学習用書籍で紹介されているThonny(Python IDE for beginners)を使って見ました。
紙媒体書籍(139ページ)は有償ですが、PDFが無料配布されています。

動作環境

  • MacBook Pro (M1 2020)
  • macOS Big Sur 11.1
  • Raspberry Pi Pico

microPythonをダウンロード

microPython[公式ページより、安定版のrp2-pico-20210202-v1.14をダウンロードします。
micropython.jpg

microPythonをインストール

(1)Raspberry Pi Picoの基板上のBOOTSEL(白いボタン)を押したまま、MacへUSB接続します。
(2)MacのFinderにRPI-RP2のドライブとして見えるので、ダウンロードしたUF2ファイルをドラックアンドドロップします。
macOS.jpg

microPythonのIDEツールをダウンロード

Thonny(Python IDE for beginners)をダウンロードして、インストールします。
IDE.jpg

Thonny(Python IDE for beginners)の設定

メニューバーのRunのSelect Interpreterから、デバイスとポートを設定します。

IDE2.png

IDE3.png

Lチカのソースコード

import machine
import utime
led = machine.Pin(25, machine.Pin.OUT)
while True:
    led.value(1)
    utime.sleep(0.5)
    led.value(0)
    utime.sleep(0.5)

Thonny(Python IDE for beginners)の実行画面

IDE1.jpg

感想

M1 Macに特別なドライバーソフトをインストールすることなく、数分で開発環境を構築できました。
お手軽に試すにはC言語より、MicroPythonの方が良いと思いました。

参考

20
13
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
20
13