LoginSignup
6
6

More than 3 years have passed since last update.

Arduinoエミュレータ SimulIDEでGAMEBUINOを動かしてみる

Last updated at Posted at 2019-08-16

はじめに

SimulIDE

Arduinoと電子回路をPC上でシミュレーションできるツールです。
https://sourceforge.net/projects/simulide/

GAMEBUINO

Arduinoで作られた携帯用ゲーム機です。
http://legacy.gamebuino.com/wiki/index.php?title=Getting_started

SimulIDEを使ったデモとして、SimulIDE上でGAMEBUINOを動かしてみます。:smiling_imp:

準備するもの

ハードウエア

シミュレータ上での実行のため、部品購入や電子工作は不要です。:grin:

ソフトウエア

実機では、SDファイルにhexファイルを入れてソフトを入れ替えできるようです。
SimulIDEでSDカードをエミュレートできないため、以下のソースコードをダウンロードし、ビルドを行います。
https://github.com/frthery/BlocksBuino

SimulIDEの編集

SimulIDEでArduino Unoとボタン、液晶(PCD8544)を配置し、結線します。

Button Arduino pin
Right Button D7
Left Button D8
Down Button D6
Up Button D9
A Button D4
B Button D2
C Button A3
PCD8544 Arduino pin
RST A0
SC A1
DC A2
DIN D11
CLK D13

image.png

ソースコードのビルド

1) 事前にArduino IDEより、BlocksBuinoをビルドするのに必要なライブラリ(Gamebuino Classic)をインクルードしておきます。
参考 http://legacy.gamebuino.com/wiki/index.php?title=Getting_started#Software_setup

2) SimulIDEより、BlocksBuino.inoを開きます。

3) SimulIDEのCompiler PathをArduino IDEのインストール先に設定しておきます。

4) SimulIDEのコンパイルボタンを押し、ビルドします。

5) コンパイルが正常に終了したら、Uploadボタンを押し、仮想Arduinoにアップロードします。
SimuliIDE_Compile.gif

仮想Arduinoの実行

1) SimulIDEのPower Circuitボタンを押しシミュレーションを開始します。

SimuliIDE_Run.gif

2) Aボタンでゲームがスタートします。:sunglasses:

※液晶画面の表示にチラツキが発生してしまうようです。:anguished:
シミュレータのCircuit設定 NoLinStepを調整したところ、少し改善しました。:smiling_imp:

さいごに

  • GAMEBUINOは、液晶表示をSPI通信で行っており、動きの早いゲームなど、リアルタイム性を完全再現するのは難しいですが、Arduinoエミュレータでも一応動作しました。:relaxed:
  • SimulIDEは、シリアル通信もシミュレーションすることができます。(デバッグに便利)
  • SimulIDEは、Aruduinoエミュレータの一つで、まだベータ版ですが、開発、教育などいろいろな場面で使えそうです。
6
6
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
6
6