LoginSignup
3
1

More than 5 years have passed since last update.

ArduBoyを自作する

Posted at

目的

Arduino環境を使用してArduboyというゲーム機が販売されています。
購入して遊ぶのも面白いですが、パーツを購入して自作するのも面白そう考えて自作に至りました。

準備

Adafruit-Itsy-Bitsy-32u4-16MHz
I2C シリアル 128×64 OLED LCDディスプレイ
圧電スピーカ
ボタン6つ(十字キー4つ、ABボタン2つ)
手のひらに収まるサイズのユニバーサル基板
はんだ付け用の工作道具
絶縁テープやボンドガン等の工作道具

回路図

Adafruit-Itsy-Bitsy<--->Display
IMG_0292.JPG

Adafruit-Itsy-Bitsy<--->スピーカ
IMG_0293.JPG

Adafruit-Itsy-Bitsy<--->ボタン
IMG_0295.JPG

Adafruit-Itsy-Bitsy<--->LED
IMG_0294.JPG

上記を半田付けします。下記のようになりました。
IMG_0297.JPG
IMG_0298.JPG

コード

いくつかのゲームはソースコードが公開されています。
Mystic Baloonのサイトからソースコードをダウンロードして使用します。
MYBL_AB/MYBL_AB.ino を使用します。

/*
  Mystic Balloon: http://www.team-arg.org/mybl-manual.html

  Arduboy version 1.7.2:  http://www.team-arg.org/mybl-downloads.html

  MADE by TEAM a.r.g. : http://www.team-arg.org/more-about.html

  2016-2018 - GAVENO - CastPixel - JO3RI - Martian220

  Game License: MIT : https://opensource.org/licenses/MIT

*/

//determine the game
#define GAME_ID 34

#include "globals.h"
#include "menu.h"
#include "game.h"
#include "inputs.h"
#include "player.h"
#include "enemies.h"
#include "elements.h"
#include "levels.h"


typedef void (*FunctionPointer) ();

const FunctionPointer PROGMEM  mainGameLoop[] = {
  stateMenuIntro,
  stateMenuMain,
  stateMenuHelp,
  stateMenuPlaySelect,
  stateMenuInfo,
  stateMenuSoundfx,
  stateGameNextLevel,
  stateGamePlaying,
  stateGamePause,
  stateGameOver,
  stateMenuPlayContinue,
  stateMenuPlayNew,
};

void setup()
{
  arduboy.boot();                                           // begin with the boot logo en setting up the device to work
  arduboy.audio.begin();
  arduboy.bootLogoSpritesSelfMasked();
  arduboy.setFrameRate(60);                                 // set the frame rate of the game at 60 fps
  loadSetEEPROM();
}

void loop() {
  if (!(arduboy.nextFrame())) return;
  if (gameState < STATE_GAME_NEXT_LEVEL && arduboy.everyXFrames(10))sparkleFrames = (++sparkleFrames) % 5;
  arduboy.pollButtons();
  arduboy.clear();
  ((FunctionPointer) pgm_read_word (&mainGameLoop[gameState]))();
  arduboy.display();
}

テスト

ArduboyでMysticBaloonを遊ぶことができればOKです。

FAQ

Board: "Arduino/Genuino Uno"
error: 'TCCR3A' was not declared in this scope
error: 'TCCR3B' was not declared in this scope

ボード選択が正しくないです。ツール→ボードから「Arduboy」を選択して下さい。
「Arduboy」が見つからなければツール→ボード→ボードマネージャから「Arduboy by Arduboy Team」を追加して下さい。

参考

組み込みエンジニアでなくても週末にArduinoを使って遊ぶ
Adafruit Itsy Bitsy 32u4 - 5V 16MHzでLチカ
Arduino互換機を作ってみた
Arduboy Library 2.0
Production Arduboy Schematic
Arduboy Manager
「Arduboy」超薄型カードサイズで懐かしいデザインの組み込みゲーム機 開封レビューとおすすめゲーム
Mystic Baloon

3
1
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
3
1