---
title: "RP2040ボードのArduinoでの判定方法 (Define method with Arduino for RP2040 board)"
url: "https://maker.wiznet.io/scarlet/projects/rp2040%E3%83%9C%E3%83%BC%E3%83%89%E3%81%AEarduino%E3%81%A7%E3%81%AE%E5%88%A4%E5%AE%9A%E6%96%B9%E6%B3%95-define-method-with-arduino-for-rp2040-board/"
markdown_url: "https://maker.wiznet.io/scarlet/projects/rp2040%E3%83%9C%E3%83%BC%E3%83%89%E3%81%AEarduino%E3%81%A7%E3%81%AE%E5%88%A4%E5%AE%9A%E6%96%B9%E6%B3%95-define-method-with-arduino-for-rp2040-board/md"
type: "UCC: User Created Content"
author: "あろしーど"
author_url: "https://aloseed.com/it/rp2040-boards-definition/"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "あろしーど"
original_url: "https://aloseed.com/it/rp2040-boards-definition/"
published: "2023-07-03"
language: "en"
likes: 0
views: 108
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# RP2040ボードのArduinoでの判定方法 (Define method with Arduino for RP2040 board)

> Judgment method with Arduino for RP2040 board

Original author: あろしーど (source: https://aloseed.com/it/rp2040-boards-definition/)

## Article

RP2040ボードの判定方法を調べてまとめてみました。

目次

1. [アーキテクチャ](https://aloseed.com/it/rp2040-boards-definition/#toc1)
  1. [アーキテクチャの判定](https://aloseed.com/it/rp2040-boards-definition/#toc2)

2. [ボード](https://aloseed.com/it/rp2040-boards-definition/#toc3)

3. [関連記事](https://aloseed.com/it/rp2040-boards-definition/#toc4)

## **アーキテクチャ**

| アーキテクチャ | 定義名 |
| --- | --- |
| Mbed | ARDUINO_ARCH_MBED |
| RP2040 | ARDUINO_ARCH_RP2040 |

### **アーキテクチャの判定**

Arduino公式版
Arduino Mbed OS RP2040 Boards

```cpp
#if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_ARCH_MBED)
// Arduino Mbed OS RP2040 Boardsの場合
#endif
```

Raspberry Pi Pico/RP2040ボード(earlephilhower版)

```cpp
#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)
// Raspberry Pi Pico/RP2040ボード(earlephilhower版)の場合
#endif
```

RP2040ボードではない場合

```cpp
#ifndef ARDUINO_ARCH_RP2040
// RP2040ではない場合
#endif
```

## **ボード**

Arduinoではboards.txtにボード定義があり、そこから定義名を取得できます。
今回主要なボードを抜粋し一覧にまとめまてみました。

| ボード | 定義名 |
| --- | --- |
| Raspberry Pi Pico | ARDUINO_RASPBERRY_PI_PICO |
| Raspberry Pi Pico W | ARDUINO_RASPBERRY_PI_PICO_W |
| Adafruit Feather RP2040 | ARDUINO_ADAFRUIT_FEATHER_RP2040 |
| Adafruit ItsyBitsy RP2040 | ARDUINO_ADAFRUIT_ITSYBITSY_RP2040 |
| Adafruit QT Py RP2040 | ARDUINO_ADAFRUIT_QTPY_RP2040 |
| Arduino Nano RP2040 Connect | ARDUINO_NANO_RP2040_CONNECT |
| Cytron Maker Nano RP2040 | ARDUINO_CYTRON_MAKER_NANO_RP2040 |
| Cytron Maker Pi RP2040 | ARDUINO_CYTRON_MAKER_PI_RP2040 |
| SparkFun ProMicro RP2040 | ARDUINO_SPARKFUN_PROMICRO_RP2040 |
| Seeed XIAO RP2040 | ARDUINO_SEEED_XIAO_RP2040 ※Ver.2.4.0以降 ARDUINO_SEEED_XAIO_RP2040 ※Ver.2.4.0より前 |
| Waveshare RP2040-Zero | ARDUINO_WAVESHARE_RP2040_ZERO |
| Waveshare RP2040-Plus | ARDUINO_WAVESHARE_RP2040_PLUS |
| Waveshare RP2040-One | ARDUINO_WAVESHARE_RP2040_ONE |
| WIZnet W5100S-EVB-Pico | ARDUINO_WIZNET_5100S_EVB_PICO |
| WIZnet WizFi360-EVB-Pico | ARDUINO_WIZNET_WIZFI360_EVB_PICO |
| WIZnet W5500-EVB-Pico | ARDUINO_WIZNET_5500_EVB_PICO |
| Generic RP2040 | ARDUINO_GENERIC_RP2040 |

判定例

```cpp
#ifdef ARDUINO_RASPBERRY_PI_PICO
// Raspberry Pi Picoの場合
#endif

#ifndef ARDUINO_RASPBERRY_PI_PICO
// Raspberry Pi Picoでない場合
#endif

// 複数の定義名を判定する場合(Seeed XIAO RP2040の例)
#if defined(ARDUINO_SEEED_XIAO_RP2040) || defined(ARDUINO_SEEED_XAIO_RP2040)
// Seeed XIAO RP2040の場合
#endif
```

---

Source: https://maker.wiznet.io/scarlet/projects/rp2040%E3%83%9C%E3%83%BC%E3%83%89%E3%81%AEarduino%E3%81%A7%E3%81%AE%E5%88%A4%E5%AE%9A%E6%96%B9%E6%B3%95-define-method-with-arduino-for-rp2040-board/
