# Arduinoハードウェア

**URL:** https://forum.ficusonline.com/t/topic/476
**Category:** Firmware
**Created:** [2023 年 1 月 16 日午前 11:46 UTC](https://forum.ficusonline.com/t/topic/476 "2023-01-16T11:46:36Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2023 年 1 月 24 日午前 2:29 UTC](https://forum.ficusonline.com/t/topic/476/4 "2023-01-24T02:29:41Z")

</div>

## Linux(Ubuntu)でPlatformIOを使用する場合

マイコンボードのUSB-Serialチップデバイスの登録が必要です。  
[99-platformio-udev.rules — PlatformIO latest documentation](https://docs.platformio.org/en/latest/core/installation/udev-rules.html)

マイコンボードのUSB-Serialチップデバイスの **VID(Vender ID)** と **PID(Product ID)** は、VSCodeのPlatformIOのターミナル（新規ターミナル）から以下のコマンドで確認できます。  
[pio device list — PlatformIO latest documentation](https://docs.platformio.org/en/latest/core/userguide/device/cmd_list.html#cmd-device-list)

```auto
$ pio device list
/dev/cu.SLAB_USBtoUART
----------
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
Description: CP2102 USB to UART Bridge Controller

/dev/cu.uart-1CFF4676258F4543
----------
Hardware ID: USB VID:PID=451:f432 SNR=1CFF4676258F4543
Description: Texas Instruments MSP-FET430UIF

```

デバイスルールのダウンロードとコピー

```auto
$ curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules

```

udev(userspace dev)サービスの再起動

```auto
$ sudo service udev restart

```

または現ユーザをデバイスの管理グループへ参加。

デバイスのグループ確認

```shell
$ ls -l /dev/ttyACM0
crw-rw-rw- 1 root dialout 166, 0 6月 28 07:25 /dev/ttyACM0

```

グループを確認後（上記の場合：dialout）、現ユーザをグループdialout, plugdevなどへ追加 **（再ログインが必要）**

```auto
$ sudo usermod -a -G dialout $USER
$ sudo usermod -a -G plugdev $USER

```

> <https://askubuntu.com/questions/133235/how-do-i-allow-non-root-access-to-ttyusb0>

* * *

Arduino Nanoでプロジェクトを作成する場合のボードの選択は、新規にブートローダをアップロードしたため下記のデバイスとします。  
[Arduino Nano ATmega328 (New Bootloader) — PlatformIO latest documentation](https://docs.platformio.org/en/latest/boards/atmelavr/nanoatmega328new.html)

**`platformio.ini`**

```auto
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino

```

---

_[View the full topic](https://forum.ficusonline.com/t/topic/476)._
