狠狠撸

狠狠撸Share a Scribd company logo
PlatformIO でシュッと
Arduino 開発を高速化しよう
Speed up your Arduino development with PlatformIO!
Atsushi Morimoto @74th
VS Code Conference Japan 2021
Atsushi Morimoto @74th
● Mobility Technologies所属
Working at Mobility Technologies, Co., Ltd.
● AIよりのサーバサイドエンジニア
Server-side engineer for AI product
タクシー乗務員支援サービスを開発
I'm developing taxi crew support service.
● 著書 books
技術書典3~11参加
published at Japanese tech fun book markets "Gijutsushoten(TechBookFest)”
Visual Studio Code Practical Guide
? Mobility Technologies Co., Ltd.
タクシー車内の機器(システム構成の一例)
Taxi equipment i(an example)
宣伝/ Mobility Technologies では車載IoT開発をやってます
We are developing in-vehicle IoT
3
Wi-Fi
Direct
Taxi Meter
Mobile Printer
後部座席タブレット
Backseat tablet
乗務員端末
Tablet for a driver
決済機
online payment
外部デバイス
Other Devices
車両信号
Connecting to
vehicle
DRIVE CHART
(Intelligent Drive Recorder)
BLEロガー
BLE logger
位置情報収集基盤
Vehicle Locations
Collection System
4G
? Mobility Technologies Co., Ltd.
今日は仕事とは別の電子工作 IoT のお話
Today, I'm going to talk about DIY IoT
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
Arduino UNO, Nano, Mini
(ATMega 328P)
Pro Micro
(ATMega 32u4)
DigiSpark
(ATTiny 85)
Arduino Nano Every
(ATMega 4809)
M5Stack Core2, Stick C
(ESP32) ESP32 DevKit C STM32
Raspberry Pi
PICO
Arduinoとは how about Arduino
● ワンボードマイコンを簡単に開発できるフレームワーク
A framework for easy development of one-board microcontrollers.
○ マイコンの差分を吸収して、マイコンの知識がなくても簡単に実装できる
Absorbs the differences in microcontrollers and it is easy to implement even without knowledge
of microcontrollers.
● USBで繋ぐだけでプログラムの書き換えができる
The program can be rewritten just by connecting it via USB.
○ 市販のはそれができるブートローダーが書き込まれている
Arduino microcontrollers on the market have a bootloader.
● 1ファイルのソースコードで完結するので、コピペで動く
A single ?le of source code is all that is needed, so you can work it with just copy and paste.
● 開発環境もArduino IDEでワンストップ
The Arduino IDE is also a one-stop development environment.
● オープンソースハードウェアとして、入手しやすい
As open source hardware, it is easy to obtain.
Arduino で動くコードCode that works on Arduino
ジョイスティックモジュール
Joystick Module
850円
https://akizukidenshi.com/catalog/g/gM-08763/
Raspberry Pi PICO
550円
https://www.marutsu.co.jp/pc/i/2194960/
Arduino で動くコード
Code that works on Arduino
setup()で、各PINの役割を設定
Set up the role of each PINs in setup().
ジョイスティックのアナログ値読み取り
Joystick analog value reading
LEDをON/OFFする
Controlling LEDs
シリアル出力
Console output
実処理はloop()に記述
The actual process is
described in loop().
Platform io で シュッと arduino 開発を高速化しよう speed up your arduino development with platformio!
今まで趣味で作ったものの紹介
the things I have made as a hobby
パルスオキシメーターPulse oximeter(M5 Stick C)
※医療機器にはなりません This is not a medical device.
https://attosci.hatenablog.com/entry/index.php/2020/04/26/m5stackc-pulseoximeter/
M5Stack用心拍センサユニットHeart
Rate Unit for M5 Stack
1,310円
https://www.switch-science.com/catalog/5695/
M5 Stick C
2,398円
https://www.switch-science.com/catalog/6350/
EOLですが、後継商品 M5 Stick C Plusがあります
EOL, but there is a successor product, M5 Stick C Plus
WiFi 空気品質モニターAir Quality Monitor(ESP32)
https://github.com/74th/esp32-air-quality-monitor
CCS811搭載 空気品質センサモジュール
Air Quality Breakout - CCS811
2,828円
https://www.switch-science.com/catalog/3298/
ESP32-WROOM-32E 開発ボードDev Board
730円
https://akizukidenshi.com/catalog/g/gK-16108/
I2C接続キャラクタLCDモジュール
I2C Connection Character LCD Module
550円
https://akizukidenshi.com/catalog/g/gK-08896/
Bluetoothキーボード電卓
BLE Keyboard Calculator
(ESP32)
Sparrow24 BLE Calculator
(自作キーボードキットDIY Keyboard Kit)
9,000円
https://74th.booth.pm/items/3338904
Arduino IDEで辛いところThe hard part of Arduino IDE
● コード補完が効かないCode completion doesn't work..
● 1ファイルで完結して、ライブラリに分割しにくい
Complete in one ?le and dif?cult to split into libraries.
● Unit TestとかできないCannot do Unit Test
● デバッグ実行できないCannot run in debugger.
※Eclipse Theta(VS Code OSSのfork)ベースのArduino IDE 2.0(現在ベータ)で
コード補完、デバッグ実行はできるようになります
With Arduino IDE 2.0 (currently in beta) based on Eclipse Theta (fork of VS Code OSS)
code completion and running in debugger will be available.
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
PlatformIOとはWhat is PlatformIO?
PlatformIOとはWhat is PlatformIO?
● VS Codeの拡張機能として提供
Provided as an extension to VS Code.
● プラットフォームを選ぶだけで、
マイコン開発に必要なソフトウェアを自動インストール
The software required for microcontroller development can be installed automatically by only selecting a platform.
● コード補完が効くCode completion(C++)
● ライブラリの自動インストール(とそのコード補完)
Automatic installation of libraries (and their code completion).
● デバッグ実行Debug run
● Unit Test
● 静的解析Static analysis
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
Platform IOのインストールInstalling PlatformIO
Platform IOのホーム画面を開くGo to PlatformIO Home
Project Wizardから目的のマイコンボードを選択
Select your microcontroller board from the Project Wizard.
利用するフレームワークを選択Select the framework
←コード
main code
←ライブラリ
Libraries
←設定ファイル
settings
platformio.iniに
先程選択した結果が格納されている
The selected contents are stored in
platformio.ini.
あらゆる操作はステータスバーにAll operations are in the status bar
ビルド
build
アップロード
(書き込み)
upload(burn)
シリアル出力
Serial outputs
アップロードUpload
 
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
RGB LEDを追加Add RGB LED
RGB LEDには共通仕様があり、
NeoPixel というライブラリで
動かせる
Some RGB LEDs can be used with the NeoPixel library.
マイコン内蔵RGBLEDモジュール(WS2812)
RGB LED module with built-in microcontroller
70円
https://akizukidenshi.com/catalog/g/gM-08414/
RGB LEDを追加Add RGB LED
RGB LEDには共通仕様があり、
NeoPixel というライブラリで
動かせる
Some RGB LEDs can be used with the NeoPixel library.
マイコン内蔵RGBLEDモジュール(WS2812)
RGB LED module with built-in microcontroller
70円
https://akizukidenshi.com/catalog/g/gM-08414/
ライブラリNeoPixelの追加 Add NeoPixel Library
RGB LEDの実装
Programing RGB LED
アナログ値をRGBに変換して表示
Using analog values as colors
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
ESP32マイコン
● WiFI、Bluetooth搭載
Equipped with WiFI and Bluetooth.
● マイコンが技適取得済み
Microcontroller has been approved for Japanese wireless
regulations “Giteki”.
● 安いLow cost
○ 公式開発ボード Of?cialDevBoard 1,230円
○ 秋月の開発ボード 730円
Akidsuki Dev Board
※Akidsuki is the most famous shop
for DIY electronic parts
○ マイコン単体 microcontroller 360円
● 市場在庫潤沢(電子工作用途、2021/11現在)
Suf?cient market stock (as of Nov. 2021 for DIY Electronics)
● 発売元がArduino対応を提供
of?cially Arduino support
● MicroPythonも公式サポート
MicroPython is also supported
● 2コア 2 cores 公式開発ボード https://akizukidenshi.com/catalog/g/gM-15673/
秋月の開発ボード https://akizukidenshi.com/catalog/g/gK-16108/
マイコン単体 https://akizukidenshi.com/catalog/g/gM-15675/
ESP32に載せ替え、Slack通知
Replaced by ESP32 for Slack noti?cation
ESP32開発へスイッチSwitch to ESP32 development
WiFiへの接続Connecting WiFi
 
Slackへの送信Send to Slack
 
ESP32へのアップロード
Upload to ESP32
Connectingが表示されてから
BOOTを押しながらENを押す
After Connecting is displayed, hold down BOOT and press EN.
アップロード後
ENでリセットして始動
After uploading, press EN to reset and start.
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
ESP32をデバッグ実行しよう
Let's run ESP32 in debugger
ESP32はJTAGという規格に対応
ESP32 supports JTAG for debugging
FT232HLで、安価に、
デバッガとして使える
The FT232HL can be used as an inexpensive JTAG debugger.
デバッグ時の設定は
vscode/launch.json ではなく
platformio.ini に記述
The con?guration for debugging is not in vscode/launch.json,
but in platformio.ini
FT232HL ハイスピードUSBシリアル変換モジュール
FT232HL High speed USB Serial Converter Module
1,200円
https://akizukidenshi.com/catalog/g/gK-06503/
ESP32へのPlatformIOでのデバッグ実行Run ESP32 in debugging with PlatformIO
デバッグ実行できると言ってもDebugging difficulties
● ファームウェアのサイズ増大Increased size of ?rmware.
● かなり遅くて繰り返し実行しづらいIt is too slow to run repeatedly.
● GPIOポートが兼用で、特定GPIOが使えなくなる
Some GPIO ports are used for debugging.
● ツールが必要Required additional tools
○ Raspberry PI Pico : Picoprobe
(※PlatformIO非対応 PlatformIO does not supported)
○ ESP32 : JTAG
(※M5Stackは必要ポートが空いていないので不可)
M5Stack can't be debugged because the required port is not available.
○ STM32 : J-Link
○ ATMega328P : debugWire
○ ATMega4048 : EDBG
VS Codeでのマイコンのデバッグの詳しい仕方は
For a detailed explanation of running microcontrollers in debugger with VS Code, see this (but Japanese only).
https://74th.booth.pm/items/3338895
Advanced debugging with VS Code 2nd Edition
(Japanese book)
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
Unit TestをしようLet's start Unit Testing
● マイコン上でUnit Testが実行できるUnit Test can be run on a microcontroller.
○ Unity Test Framework
● PC上でも実行できるCan be run on a PC
● テスト対象は lib/ ディレクトリ下のライブラリ
The test targets are libraries under the lib/ directory
Unit Testのためのソースコードの構成Structure of the source code for the Unit Test
テストコード
test code
テスト対象コード
codes to be tested
Switch by build ?ag
ビルドフラグで切り替えSwitch by build ?ag
私はほとんど活用できていない…… I have barely scratched the surface
● ArduinoFake.h で Arduino.h のカバーが不十分
I think that ArduinoFake.h is inadequate to cover the scope of Arduino.h.
○ ESP32専用ライブラリはない(WiFi.hとか)
No ESP32-speci?c library (like WiFi.h)
● マイコンへの入力がない範囲しか検証できない
I can only verify tests that have no input to the microcontroller.
○ ボタンが押されているかとか、アナログ入力とか分岐できない
Can not test branching for button presses, analog inputs, etc.
● Arduinoに依存しないコードのテストであれば、
PlatformIOで実行する必要はない。
I thought that if the test does not depend on Arduino, it does not need to test on PlatformIO.
● デバッグ実行できない
Cannot run in debugger
目次Agenda
● Arduino と、私の Arduino 歴Arduino and my Arduino history
● PlatformIO とは What is PlatformIO?
● PlarformIOを使った開発Development with PlarformIO
○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO!
○ RGB LEDのライブラリを追加!Added RGB LED library!
○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32!
○ ESP32 をデバッグ実行!Run ESP32 in debugger!
○ Unit TestやってみようLet's try Unit Test!
● まとめSummary
まとめSummary
● Arduinoで、マイコン開発を簡単に
Arduino makes microcontroller development easy.
● PlatformIO で、シュッと開発
Speed up your development with PlatformIO.
○ 環境構築 Building the environment
○ ライブラリの管理と、インストール
Library management and installtion
○ デバッグ実行Run in debugger
○ Unit Test
● Raspberry Pi PICOも良いけど、
ネットに繋ぎたくなったら ESP32 !
Raspberry Pi PICO is good, but if you want to connect to the internet,
ESP32 is better!
ArduinoとPlatformIOでIoTを楽しもう!
Let's enjoy IoT with Arduino and PlatformIO!

More Related Content

What's hot (20)

搁别诲尘颈苍别の基本と适用事例
搁别诲尘颈苍别の基本と适用事例搁别诲尘颈苍别の基本と适用事例
搁别诲尘颈苍别の基本と适用事例
Go Maeda
?
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみるいまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
裕士 常田
?
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャーKubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Toru Makabe
?
大规模サービスを支えるネットワークインフラの全貌
大规模サービスを支えるネットワークインフラの全貌大规模サービスを支えるネットワークインフラの全貌
大规模サービスを支えるネットワークインフラの全貌
LINE Corporation
?
これからの「补蝉测苍肠/补飞补颈迟」の话をしよう
これからの「补蝉测苍肠/补飞补颈迟」の话をしようこれからの「补蝉测苍肠/补飞补颈迟」の话をしよう
これからの「补蝉测苍肠/补飞补颈迟」の话をしよう
Kouji Matsui
?
顿辞肠办别谤と笔辞诲尘补苍の比较
顿辞肠办别谤と笔辞诲尘补苍の比较顿辞肠办别谤と笔辞诲尘补苍の比较
顿辞肠办别谤と笔辞诲尘补苍の比较
Akihiro Suda
?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
Takayuki Shimizukawa
?
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
Hirokazu Onomichi
?
【Unity道場 2月】シェーダを書けるプログラマになろう
【Unity道場 2月】シェーダを書けるプログラマになろう【Unity道場 2月】シェーダを書けるプログラマになろう
【Unity道場 2月】シェーダを書けるプログラマになろう
Unity Technologies Japan K.K.
?
UnityによるAR/VR/MR 開発体験講座
UnityによるAR/VR/MR 開発体験講座UnityによるAR/VR/MR 開発体験講座
UnityによるAR/VR/MR 開発体験講座
Yuichi Ishii
?
20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)
Kentaro Ebisawa
?
谤耻产测-蹿蹿颈についてざっくり解説
谤耻产测-蹿蹿颈についてざっくり解説谤耻产测-蹿蹿颈についてざっくり解説
谤耻产测-蹿蹿颈についてざっくり解説
ota42y
?
カスタムメモリマネージャと高速なメモリアロケータについて
カスタムメモリマネージャと高速なメモリアロケータについてカスタムメモリマネージャと高速なメモリアロケータについて
カスタムメモリマネージャと高速なメモリアロケータについて
alwei
?
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
mganeko
?
搁别诲尘颈苍别の情报を自分好みに见える化した话
搁别诲尘颈苍别の情报を自分好みに见える化した话搁别诲尘颈苍别の情报を自分好みに见える化した话
搁别诲尘颈苍别の情报を自分好みに见える化した话
ToshiharuSakai
?
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
Yoshifumi Kawai
?
A quick tour of the Cysharp OSS
A quick tour of the Cysharp OSSA quick tour of the Cysharp OSS
A quick tour of the Cysharp OSS
Yoshifumi Kawai
?
30分で分かる!翱厂の作り方
30分で分かる!翱厂の作り方30分で分かる!翱厂の作り方
30分で分かる!翱厂の作り方
uchan_nos
?
鲍蝉产接続するアフ?リを开発した时に试行错误した事
鲍蝉产接続するアフ?リを开発した时に试行错误した事鲍蝉产接続するアフ?リを开発した时に试行错误した事
鲍蝉产接続するアフ?リを开発した时に试行错误した事
Masataka Kono
?
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
Tetsuyuki Kobayashi
?
搁别诲尘颈苍别の基本と适用事例
搁别诲尘颈苍别の基本と适用事例搁别诲尘颈苍别の基本と适用事例
搁别诲尘颈苍别の基本と适用事例
Go Maeda
?
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみるいまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
いまどきの組込みOSの? ZephyrRTOSと? OpenThreadを? Arduino環境で遊んでみる
裕士 常田
?
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャーKubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
Toru Makabe
?
大规模サービスを支えるネットワークインフラの全貌
大规模サービスを支えるネットワークインフラの全貌大规模サービスを支えるネットワークインフラの全貌
大规模サービスを支えるネットワークインフラの全貌
LINE Corporation
?
これからの「补蝉测苍肠/补飞补颈迟」の话をしよう
これからの「补蝉测苍肠/补飞补颈迟」の话をしようこれからの「补蝉测苍肠/补飞补颈迟」の话をしよう
これからの「补蝉测苍肠/补飞补颈迟」の话をしよう
Kouji Matsui
?
顿辞肠办别谤と笔辞诲尘补苍の比较
顿辞肠办别谤と笔辞诲尘补苍の比较顿辞肠办别谤と笔辞诲尘补苍の比较
顿辞肠办别谤と笔辞诲尘补苍の比较
Akihiro Suda
?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
笔测迟丑辞苍はどうやって濒别苍関数で长さを手にいれているの?
Takayuki Shimizukawa
?
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
ROS2講習会の報告 (瀬戸内ROS勉強会#02にて)
Hirokazu Onomichi
?
【Unity道場 2月】シェーダを書けるプログラマになろう
【Unity道場 2月】シェーダを書けるプログラマになろう【Unity道場 2月】シェーダを書けるプログラマになろう
【Unity道場 2月】シェーダを書けるプログラマになろう
Unity Technologies Japan K.K.
?
UnityによるAR/VR/MR 開発体験講座
UnityによるAR/VR/MR 開発体験講座UnityによるAR/VR/MR 開発体験講座
UnityによるAR/VR/MR 開発体験講座
Yuichi Ishii
?
20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)20111015 勉強会 (PCIe / SR-IOV)
20111015 勉強会 (PCIe / SR-IOV)
Kentaro Ebisawa
?
谤耻产测-蹿蹿颈についてざっくり解説
谤耻产测-蹿蹿颈についてざっくり解説谤耻产测-蹿蹿颈についてざっくり解説
谤耻产测-蹿蹿颈についてざっくり解説
ota42y
?
カスタムメモリマネージャと高速なメモリアロケータについて
カスタムメモリマネージャと高速なメモリアロケータについてカスタムメモリマネージャと高速なメモリアロケータについて
カスタムメモリマネージャと高速なメモリアロケータについて
alwei
?
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
奥别产搁罢颁のオーディオ処理の谜、谁か教えて!
mganeko
?
搁别诲尘颈苍别の情报を自分好みに见える化した话
搁别诲尘颈苍别の情报を自分好みに见える化した话搁别诲尘颈苍别の情报を自分好みに见える化した话
搁别诲尘颈苍别の情报を自分好みに见える化した话
ToshiharuSakai
?
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
Yoshifumi Kawai
?
A quick tour of the Cysharp OSS
A quick tour of the Cysharp OSSA quick tour of the Cysharp OSS
A quick tour of the Cysharp OSS
Yoshifumi Kawai
?
30分で分かる!翱厂の作り方
30分で分かる!翱厂の作り方30分で分かる!翱厂の作り方
30分で分かる!翱厂の作り方
uchan_nos
?
鲍蝉产接続するアフ?リを开発した时に试行错误した事
鲍蝉产接続するアフ?リを开発した时に试行错误した事鲍蝉产接続するアフ?リを开発した时に试行错误した事
鲍蝉产接続するアフ?リを开発した时に试行错误した事
Masataka Kono
?
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
组み込み尝颈苍耻虫での骋辞濒补苍驳のススメ
Tetsuyuki Kobayashi
?

Similar to Platform io で シュッと arduino 開発を高速化しよう speed up your arduino development with platformio! (20)

福井スマートフォンハッカソン Titanium Mobileの紹介
福井スマートフォンハッカソン Titanium Mobileの紹介福井スマートフォンハッカソン Titanium Mobileの紹介
福井スマートフォンハッカソン Titanium Mobileの紹介
Mori Shingo
?
ソフトウェア技术者から见た贵笔骋础の魅力と可能性
ソフトウェア技术者から见た贵笔骋础の魅力と可能性ソフトウェア技术者から见た贵笔骋础の魅力と可能性
ソフトウェア技术者から见た贵笔骋础の魅力と可能性
Kenichiro MITSUDA
?
厂颈苍驳耻濒补谤颈迟测で分散深层学习
厂颈苍驳耻濒补谤颈迟测で分散深层学习厂颈苍驳耻濒补谤颈迟测で分散深层学习
厂颈苍驳耻濒补谤颈迟测で分散深层学习
Hitoshi Sato
?
イチからはじめる础顿碍北海道支部勉强会発表资料
イチからはじめる础顿碍北海道支部勉强会発表资料イチからはじめる础顿碍北海道支部勉强会発表资料
イチからはじめる础顿碍北海道支部勉强会発表资料
Kenichi Yoshida
?
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステムPython, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Junichi Kakisako
?
ソニーのディープラーニングツールで简単エッジコンピューティング
ソニーのディープラーニングツールで简単エッジコンピューティングソニーのディープラーニングツールで简単エッジコンピューティング
ソニーのディープラーニングツールで简単エッジコンピューティング
Ryohei Kamiya
?
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
ShigekiInatama
?
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
titoi2
?
ET2016 Smart Japan Alliance Llilum 161118
ET2016 Smart Japan Alliance Llilum 161118ET2016 Smart Japan Alliance Llilum 161118
ET2016 Smart Japan Alliance Llilum 161118
Atomu Hidaka
?
使い倒そう Visual Studio Code! ~クラウド連携や遠隔ペアプロ、  もちろん Git も便利に~
使い倒そう Visual Studio Code!~クラウド連携や遠隔ペアプロ、 もちろん Git も便利に~使い倒そう Visual Studio Code!~クラウド連携や遠隔ペアプロ、 もちろん Git も便利に~
使い倒そう Visual Studio Code! ~クラウド連携や遠隔ペアプロ、  もちろん Git も便利に~
Saki Homma
?
コードを书かずに尝チカ。から始めよう
コードを书かずに尝チカ。から始めようコードを书かずに尝チカ。から始めよう
コードを书かずに尝チカ。から始めよう
Shin-ya Koga
?
GTC Japan 2017
GTC Japan 2017GTC Japan 2017
GTC Japan 2017
Hitoshi Sato
?
Let’s play windows 10 io t on raspberry pi !
Let’s play windows 10 io t on raspberry pi !Let’s play windows 10 io t on raspberry pi !
Let’s play windows 10 io t on raspberry pi !
Masuda Tomoaki
?
碍濒辞肠飞辞谤办のご绍介
碍濒辞肠飞辞谤办のご绍介碍濒辞肠飞辞谤办のご绍介
碍濒辞肠飞辞谤办のご绍介
Masaru Horioka
?
Mbed祭り 2017@春の新横浜 20170225 竹之下
Mbed祭り 2017@春の新横浜 20170225 竹之下Mbed祭り 2017@春の新横浜 20170225 竹之下
Mbed祭り 2017@春の新横浜 20170225 竹之下
Koyo Takenoshita
?
静的解析ツール Klocworkによる 機能安全規格への対応
静的解析ツール Klocworkによる 機能安全規格への対応静的解析ツール Klocworkによる 機能安全規格への対応
静的解析ツール Klocworkによる 機能安全規格への対応
Masaru Horioka
?
今すぐ始める础谤诲耻颈苍辞
今すぐ始める础谤诲耻颈苍辞今すぐ始める础谤诲耻颈苍辞
今すぐ始める础谤诲耻颈苍辞
funa3
?
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
Yasuhiko Yamamoto
?
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
Yasuhiko Yamamoto
?
福井スマートフォンハッカソン Titanium Mobileの紹介
福井スマートフォンハッカソン Titanium Mobileの紹介福井スマートフォンハッカソン Titanium Mobileの紹介
福井スマートフォンハッカソン Titanium Mobileの紹介
Mori Shingo
?
ソフトウェア技术者から见た贵笔骋础の魅力と可能性
ソフトウェア技术者から见た贵笔骋础の魅力と可能性ソフトウェア技术者から见た贵笔骋础の魅力と可能性
ソフトウェア技术者から见た贵笔骋础の魅力と可能性
Kenichiro MITSUDA
?
厂颈苍驳耻濒补谤颈迟测で分散深层学习
厂颈苍驳耻濒补谤颈迟测で分散深层学习厂颈苍驳耻濒补谤颈迟测で分散深层学习
厂颈苍驳耻濒补谤颈迟测で分散深层学习
Hitoshi Sato
?
イチからはじめる础顿碍北海道支部勉强会発表资料
イチからはじめる础顿碍北海道支部勉强会発表资料イチからはじめる础顿碍北海道支部勉强会発表资料
イチからはじめる础顿碍北海道支部勉强会発表资料
Kenichi Yoshida
?
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステムPython, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Python, RaspberryPi, Arduinoで作る消費電力モニタリングシステム
Junichi Kakisako
?
ソニーのディープラーニングツールで简単エッジコンピューティング
ソニーのディープラーニングツールで简単エッジコンピューティングソニーのディープラーニングツールで简単エッジコンピューティング
ソニーのディープラーニングツールで简単エッジコンピューティング
Ryohei Kamiya
?
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
組込エンジニアにも役立つ!Node-RED活用術(for Node-RED Con. Osaka)
ShigekiInatama
?
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
プロペラブ贵辞谤迟丑発表辞蝉肠爱媛
titoi2
?
ET2016 Smart Japan Alliance Llilum 161118
ET2016 Smart Japan Alliance Llilum 161118ET2016 Smart Japan Alliance Llilum 161118
ET2016 Smart Japan Alliance Llilum 161118
Atomu Hidaka
?
使い倒そう Visual Studio Code! ~クラウド連携や遠隔ペアプロ、  もちろん Git も便利に~
使い倒そう Visual Studio Code!~クラウド連携や遠隔ペアプロ、 もちろん Git も便利に~使い倒そう Visual Studio Code!~クラウド連携や遠隔ペアプロ、 もちろん Git も便利に~
使い倒そう Visual Studio Code! ~クラウド連携や遠隔ペアプロ、  もちろん Git も便利に~
Saki Homma
?
コードを书かずに尝チカ。から始めよう
コードを书かずに尝チカ。から始めようコードを书かずに尝チカ。から始めよう
コードを书かずに尝チカ。から始めよう
Shin-ya Koga
?
Let’s play windows 10 io t on raspberry pi !
Let’s play windows 10 io t on raspberry pi !Let’s play windows 10 io t on raspberry pi !
Let’s play windows 10 io t on raspberry pi !
Masuda Tomoaki
?
碍濒辞肠飞辞谤办のご绍介
碍濒辞肠飞辞谤办のご绍介碍濒辞肠飞辞谤办のご绍介
碍濒辞肠飞辞谤办のご绍介
Masaru Horioka
?
Mbed祭り 2017@春の新横浜 20170225 竹之下
Mbed祭り 2017@春の新横浜 20170225 竹之下Mbed祭り 2017@春の新横浜 20170225 竹之下
Mbed祭り 2017@春の新横浜 20170225 竹之下
Koyo Takenoshita
?
静的解析ツール Klocworkによる 機能安全規格への対応
静的解析ツール Klocworkによる 機能安全規格への対応静的解析ツール Klocworkによる 機能安全規格への対応
静的解析ツール Klocworkによる 機能安全規格への対応
Masaru Horioka
?
今すぐ始める础谤诲耻颈苍辞
今すぐ始める础谤诲耻颈苍辞今すぐ始める础谤诲耻颈苍辞
今すぐ始める础谤诲耻颈苍辞
funa3
?
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
わんくま名古屋 #37 (20151114) Windows 10 UWP アプリ開発入門(実践編)
Yasuhiko Yamamoto
?
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
わんくま名古屋#36 (20150725) Windows 10 ユニバーサル Windows アプリ開発入門
Yasuhiko Yamamoto
?

Platform io で シュッと arduino 開発を高速化しよう speed up your arduino development with platformio!

  • 1. PlatformIO でシュッと Arduino 開発を高速化しよう Speed up your Arduino development with PlatformIO! Atsushi Morimoto @74th VS Code Conference Japan 2021
  • 2. Atsushi Morimoto @74th ● Mobility Technologies所属 Working at Mobility Technologies, Co., Ltd. ● AIよりのサーバサイドエンジニア Server-side engineer for AI product タクシー乗務員支援サービスを開発 I'm developing taxi crew support service. ● 著書 books 技術書典3~11参加 published at Japanese tech fun book markets "Gijutsushoten(TechBookFest)” Visual Studio Code Practical Guide ? Mobility Technologies Co., Ltd.
  • 3. タクシー車内の機器(システム構成の一例) Taxi equipment i(an example) 宣伝/ Mobility Technologies では車載IoT開発をやってます We are developing in-vehicle IoT 3 Wi-Fi Direct Taxi Meter Mobile Printer 後部座席タブレット Backseat tablet 乗務員端末 Tablet for a driver 決済機 online payment 外部デバイス Other Devices 車両信号 Connecting to vehicle DRIVE CHART (Intelligent Drive Recorder) BLEロガー BLE logger 位置情報収集基盤 Vehicle Locations Collection System 4G ? Mobility Technologies Co., Ltd.
  • 5. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 6. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 7. Arduino UNO, Nano, Mini (ATMega 328P) Pro Micro (ATMega 32u4) DigiSpark (ATTiny 85) Arduino Nano Every (ATMega 4809) M5Stack Core2, Stick C (ESP32) ESP32 DevKit C STM32 Raspberry Pi PICO
  • 8. Arduinoとは how about Arduino ● ワンボードマイコンを簡単に開発できるフレームワーク A framework for easy development of one-board microcontrollers. ○ マイコンの差分を吸収して、マイコンの知識がなくても簡単に実装できる Absorbs the differences in microcontrollers and it is easy to implement even without knowledge of microcontrollers. ● USBで繋ぐだけでプログラムの書き換えができる The program can be rewritten just by connecting it via USB. ○ 市販のはそれができるブートローダーが書き込まれている Arduino microcontrollers on the market have a bootloader. ● 1ファイルのソースコードで完結するので、コピペで動く A single ?le of source code is all that is needed, so you can work it with just copy and paste. ● 開発環境もArduino IDEでワンストップ The Arduino IDE is also a one-stop development environment. ● オープンソースハードウェアとして、入手しやすい As open source hardware, it is easy to obtain.
  • 9. Arduino で動くコードCode that works on Arduino ジョイスティックモジュール Joystick Module 850円 https://akizukidenshi.com/catalog/g/gM-08763/ Raspberry Pi PICO 550円 https://www.marutsu.co.jp/pc/i/2194960/
  • 10. Arduino で動くコード Code that works on Arduino setup()で、各PINの役割を設定 Set up the role of each PINs in setup(). ジョイスティックのアナログ値読み取り Joystick analog value reading LEDをON/OFFする Controlling LEDs シリアル出力 Console output 実処理はloop()に記述 The actual process is described in loop().
  • 13. パルスオキシメーターPulse oximeter(M5 Stick C) ※医療機器にはなりません This is not a medical device. https://attosci.hatenablog.com/entry/index.php/2020/04/26/m5stackc-pulseoximeter/ M5Stack用心拍センサユニットHeart Rate Unit for M5 Stack 1,310円 https://www.switch-science.com/catalog/5695/ M5 Stick C 2,398円 https://www.switch-science.com/catalog/6350/ EOLですが、後継商品 M5 Stick C Plusがあります EOL, but there is a successor product, M5 Stick C Plus
  • 14. WiFi 空気品質モニターAir Quality Monitor(ESP32) https://github.com/74th/esp32-air-quality-monitor CCS811搭載 空気品質センサモジュール Air Quality Breakout - CCS811 2,828円 https://www.switch-science.com/catalog/3298/ ESP32-WROOM-32E 開発ボードDev Board 730円 https://akizukidenshi.com/catalog/g/gK-16108/ I2C接続キャラクタLCDモジュール I2C Connection Character LCD Module 550円 https://akizukidenshi.com/catalog/g/gK-08896/
  • 15. Bluetoothキーボード電卓 BLE Keyboard Calculator (ESP32) Sparrow24 BLE Calculator (自作キーボードキットDIY Keyboard Kit) 9,000円 https://74th.booth.pm/items/3338904
  • 16. Arduino IDEで辛いところThe hard part of Arduino IDE ● コード補完が効かないCode completion doesn't work.. ● 1ファイルで完結して、ライブラリに分割しにくい Complete in one ?le and dif?cult to split into libraries. ● Unit TestとかできないCannot do Unit Test ● デバッグ実行できないCannot run in debugger. ※Eclipse Theta(VS Code OSSのfork)ベースのArduino IDE 2.0(現在ベータ)で コード補完、デバッグ実行はできるようになります With Arduino IDE 2.0 (currently in beta) based on Eclipse Theta (fork of VS Code OSS) code completion and running in debugger will be available.
  • 17. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 19. PlatformIOとはWhat is PlatformIO? ● VS Codeの拡張機能として提供 Provided as an extension to VS Code. ● プラットフォームを選ぶだけで、 マイコン開発に必要なソフトウェアを自動インストール The software required for microcontroller development can be installed automatically by only selecting a platform. ● コード補完が効くCode completion(C++) ● ライブラリの自動インストール(とそのコード補完) Automatic installation of libraries (and their code completion). ● デバッグ実行Debug run ● Unit Test ● 静的解析Static analysis
  • 20. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 21. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 24. Project Wizardから目的のマイコンボードを選択 Select your microcontroller board from the Project Wizard.
  • 27. あらゆる操作はステータスバーにAll operations are in the status bar ビルド build アップロード (書き込み) upload(burn) シリアル出力 Serial outputs
  • 29. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 30. RGB LEDを追加Add RGB LED RGB LEDには共通仕様があり、 NeoPixel というライブラリで 動かせる Some RGB LEDs can be used with the NeoPixel library. マイコン内蔵RGBLEDモジュール(WS2812) RGB LED module with built-in microcontroller 70円 https://akizukidenshi.com/catalog/g/gM-08414/
  • 31. RGB LEDを追加Add RGB LED RGB LEDには共通仕様があり、 NeoPixel というライブラリで 動かせる Some RGB LEDs can be used with the NeoPixel library. マイコン内蔵RGBLEDモジュール(WS2812) RGB LED module with built-in microcontroller 70円 https://akizukidenshi.com/catalog/g/gM-08414/
  • 33. RGB LEDの実装 Programing RGB LED アナログ値をRGBに変換して表示 Using analog values as colors
  • 34. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 35. ESP32マイコン ● WiFI、Bluetooth搭載 Equipped with WiFI and Bluetooth. ● マイコンが技適取得済み Microcontroller has been approved for Japanese wireless regulations “Giteki”. ● 安いLow cost ○ 公式開発ボード Of?cialDevBoard 1,230円 ○ 秋月の開発ボード 730円 Akidsuki Dev Board ※Akidsuki is the most famous shop for DIY electronic parts ○ マイコン単体 microcontroller 360円 ● 市場在庫潤沢(電子工作用途、2021/11現在) Suf?cient market stock (as of Nov. 2021 for DIY Electronics) ● 発売元がArduino対応を提供 of?cially Arduino support ● MicroPythonも公式サポート MicroPython is also supported ● 2コア 2 cores 公式開発ボード https://akizukidenshi.com/catalog/g/gM-15673/ 秋月の開発ボード https://akizukidenshi.com/catalog/g/gK-16108/ マイコン単体 https://akizukidenshi.com/catalog/g/gM-15675/
  • 40. ESP32へのアップロード Upload to ESP32 Connectingが表示されてから BOOTを押しながらENを押す After Connecting is displayed, hold down BOOT and press EN. アップロード後 ENでリセットして始動 After uploading, press EN to reset and start.
  • 41. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 42. ESP32をデバッグ実行しよう Let's run ESP32 in debugger ESP32はJTAGという規格に対応 ESP32 supports JTAG for debugging FT232HLで、安価に、 デバッガとして使える The FT232HL can be used as an inexpensive JTAG debugger. デバッグ時の設定は vscode/launch.json ではなく platformio.ini に記述 The con?guration for debugging is not in vscode/launch.json, but in platformio.ini FT232HL ハイスピードUSBシリアル変換モジュール FT232HL High speed USB Serial Converter Module 1,200円 https://akizukidenshi.com/catalog/g/gK-06503/
  • 44. デバッグ実行できると言ってもDebugging difficulties ● ファームウェアのサイズ増大Increased size of ?rmware. ● かなり遅くて繰り返し実行しづらいIt is too slow to run repeatedly. ● GPIOポートが兼用で、特定GPIOが使えなくなる Some GPIO ports are used for debugging. ● ツールが必要Required additional tools ○ Raspberry PI Pico : Picoprobe (※PlatformIO非対応 PlatformIO does not supported) ○ ESP32 : JTAG (※M5Stackは必要ポートが空いていないので不可) M5Stack can't be debugged because the required port is not available. ○ STM32 : J-Link ○ ATMega328P : debugWire ○ ATMega4048 : EDBG
  • 45. VS Codeでのマイコンのデバッグの詳しい仕方は For a detailed explanation of running microcontrollers in debugger with VS Code, see this (but Japanese only). https://74th.booth.pm/items/3338895 Advanced debugging with VS Code 2nd Edition (Japanese book)
  • 46. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 47. Unit TestをしようLet's start Unit Testing ● マイコン上でUnit Testが実行できるUnit Test can be run on a microcontroller. ○ Unity Test Framework ● PC上でも実行できるCan be run on a PC ● テスト対象は lib/ ディレクトリ下のライブラリ The test targets are libraries under the lib/ directory
  • 48. Unit Testのためのソースコードの構成Structure of the source code for the Unit Test テストコード test code テスト対象コード codes to be tested Switch by build ?ag
  • 50. 私はほとんど活用できていない…… I have barely scratched the surface ● ArduinoFake.h で Arduino.h のカバーが不十分 I think that ArduinoFake.h is inadequate to cover the scope of Arduino.h. ○ ESP32専用ライブラリはない(WiFi.hとか) No ESP32-speci?c library (like WiFi.h) ● マイコンへの入力がない範囲しか検証できない I can only verify tests that have no input to the microcontroller. ○ ボタンが押されているかとか、アナログ入力とか分岐できない Can not test branching for button presses, analog inputs, etc. ● Arduinoに依存しないコードのテストであれば、 PlatformIOで実行する必要はない。 I thought that if the test does not depend on Arduino, it does not need to test on PlatformIO. ● デバッグ実行できない Cannot run in debugger
  • 51. 目次Agenda ● Arduino と、私の Arduino 歴Arduino and my Arduino history ● PlatformIO とは What is PlatformIO? ● PlarformIOを使った開発Development with PlarformIO ○ Raspberry Pi PICO を開発開始!Started developing with Raspberry Pi PICO! ○ RGB LEDのライブラリを追加!Added RGB LED library! ○ ESP32 でIoTアプリに変更!Change to an IoT app with ESP32! ○ ESP32 をデバッグ実行!Run ESP32 in debugger! ○ Unit TestやってみようLet's try Unit Test! ● まとめSummary
  • 52. まとめSummary ● Arduinoで、マイコン開発を簡単に Arduino makes microcontroller development easy. ● PlatformIO で、シュッと開発 Speed up your development with PlatformIO. ○ 環境構築 Building the environment ○ ライブラリの管理と、インストール Library management and installtion ○ デバッグ実行Run in debugger ○ Unit Test ● Raspberry Pi PICOも良いけど、 ネットに繋ぎたくなったら ESP32 ! Raspberry Pi PICO is good, but if you want to connect to the internet, ESP32 is better! ArduinoとPlatformIOでIoTを楽しもう! Let's enjoy IoT with Arduino and PlatformIO!