Sony Spresense を使用した、サイクルコンピュータのプロジェクト。
- マイコンボード: Sony Spresense + 拡張ボード
- ディスプレイ: LCD または 7 セグメント LED
src/Config.hで切り替え可能
- 入力: タクトスイッチ x 2
- 電源: 発電機
本プロジェクトは Arduino IDE / Arduino CLI で開発されている。
ソースコードは src ディレクトリ配下に機能ごとに整理されている。
Spresense-CycleComputer.ino # Arduinoスケッチのエントリーポイント
docs/ # ドキュメント (要件定義書など)
src/
├── Config.h # ディスプレイタイプ等の全体設定
├── interfaces/ # インターフェース定義 (IDisplay等)
├── drivers/ # ハードウェア制御 (LCD, Button, GPS)
└── system/ # アプリケーションロジック (CycleComputer, InputManager等)
以下のツールが必要。
- Arduino CLI
- make
ビルドには Arduino Core のインストールが必要。以下のコマンドでインストール。
# Spresense 用のパッケージURLを追加
arduino-cli config init
arduino-cli config add board_manager.additional_urls https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/generic/package_spresense_index.json
# インデックスの更新
arduino-cli core update-index
# Spresense と Arduino AVR コアのインストール
arduino-cli core install SPRESENSE:spresense
arduino-cli core install arduino:avr以下のコマンドで必要なライブラリをインストール。
# I2C LCD用ライブラリ
arduino-cli lib install "LiquidCrystal I2C"プロジェクトのルートで以下のコマンドを実行。
# Spresense 向けビルド (デフォルト)
make spresense
# Arduino 向けビルド
make arduinoPC とデバイスを接続し、ポートを指定して実行。
# Spresense への書き込み例
make upload_spresense PORT=/dev/ttyACM0
# Arduino への書き込み例
make upload_arduino PORT=/dev/ttyUSB0Arduino IDE を使って cyclecomputer.ino を開き、ビルド・書き込みを行うことも可能。
src/Config.h ファイルにて、使用するディスプレイタイプの設定が可能。
// 例: LCDを使用する場合
#define DISPLAY_TYPE DISPLAY_LCD
// 例: 7セグを使用する場合
// #define DISPLAY_TYPE DISPLAY_SEVENSEG