マリオガシャット詳細 その2(英訳付き) Details of the Mario Gashat −Part 2

th_mario-gashat-30

前回に引き続き、マリオガシャットの作り方の詳細を英訳付きで書いていきます。今回は内部の説明になります。

なお、今回改めて解説を作成するにあたり、一部設計を見直しました。おかげで、以前よりは安定して遊べるようになりました。まあ、見た目は何も変わっていませんけれど。

2. 内側 / Inside

回路図 / Circuit Diagram

回路図は以下のようになります。

The circuit diagram in the Mario Gashat is as follow:

 

th_mario-gashat-23

ボタンは以下に対応しています。

Each number of button switches are corresponding to each number in the  following picture:

th_gashat-9

ArduinoはArduion Pro mini 3.3V 8MHz版を使用しています。

The Arduino board I use is “Arduino Pro mini 3.3V 8MHz.”

実際に配線したものが以下になります。

The actual wiring are as follows:

th_mario-gashat-33

th_mario-gashat-34

ケース加工 / Case Processing

th_mario-gashat-36

とにかくスペースが足りないので、追加の部品と干渉するところはすべてカットしてしまっています。

There is no room in a gashat, so you should cut all what interfere with added parts as you can.

th_mario-gashat-27

この部分は、

In this part, 

th_mario-gashat-29

このようにボタン(タクトスイッチ)をはめ込むため、プラ板を当てて接着剤で固定しています。

you should add extra plastic plates with adhesion bond in order to set a tactile switch.

スライドスイッチ / Slide Switch

th_mario-gashat-26

スライドスイッチはこのように組み込んでいます。

A slide switch is embedded in like this.

バッテリー / Battery

th_mario-gashat-35

バッテリーには3.7Vの最小サイズのリチウムイオンポリマー電池を使用しています。

I use the smallest lithium ion polymer battery whose voltage is 3.7V.

MP3プレーヤー & スピーカー / MP3 Player & Speaker

th_mario-gashat-24

th_mario-gashat-25

元々のガシャットに入っていたスピーカーは大き過ぎるので、小型のスピーカーに置き換えます。MP3プレイヤーとしてはDF PlayerMiniを使用し、小型スピーカーと重ねて収納しています。

A speaker which an original gashat has is too large, so you should replace it with smaller one. I use a “DFPlayer mini” as MP3 player, and set it over the small speaker.

フルカラーLED / RGB LED

th_mario-gashat-32

元々のガシャットの基板の代わりに、厚さ1.2mmのプラ板の上に貼り付けます。

You should put a RGB LED on a plastic plate whose thickness is 1.2mm instead of an original electronic substrate.

th_mario-gashat-31

位置はクリアーパーツと合わせます。

You should adjust the position of the LED to a clear parts.

ボタン / Button Switches

th_mario-gashat-38

th_mario-gashat-37

ボタン1と2は、元々のガシャットでは軽い力で動作するプッシュスイッチを使用していますが、今回は導電ゴムを使う方法をとっています。ただ、この方法は調整が難しいので、可能であれば、元々のガシャットについているプッシュスイッチをそのまま流用するのが良いと思います。

An original gashat uses push-button switches for button 1 & 2, which we can push with weak force. Instead I use conductive rubber sheets, but it’s difficult to adjust them. If you can, you should use the same push-button switches as what an original gashat has.

(2017/3/5 追記)

上記の部分は色々試行錯誤したのですが、今のところは導電ゴム+導電性グリスの組み合わせで落ち着いています。導電ゴムはaitendoさんで販売されているものを使用しています。電気の流れる方向が決まっているので、表面に以下の導電性グリスを塗って面全体での導電性を確保するような感じです。

 

th_mario-gashat-29

ボタン3は、ゴム性のタクトスイッチを新しく追加しています。

For button switch 3, I add a rubber tactile switch.

ソースコード / Source Code

今回設計を一部見直したため、それに伴い、ソースコードも一部変更致しました。

I modified a part of design from that in this article,  so the source code also needs to be modified as follow:

#include <string.h>
#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>
#include <Adafruit_NeoPixel.h>

#define BUTTON_1_PIN 4
#define BUTTON_2_PIN 5
#define BUTTON_3_PIN 6
#define LED_PIN      7

#define NUM_OF_LED  1

#define GASHAT_OFF       0
#define GASHAT_NAME      1
#define GAME_CLEAR       2
#define GAME_OVER        3
#define LEVEL_1          4
#define LEVEL_2          5
#define LEVEL_3          6
#define GASHAT_IN        7
#define GASHAT_OUT       8
#define DRIVER_CLOSE     9
#define CRITICAL_STRIKE 10
#define CRITICAL_READY  11
#define CRITICAL_FINISH 12
#define GENRE           13

#define N_BUTTON 3
#define BT1_ON  HIGH
#define BT1_OFF LOW
#define BT2_ON  HIGH
#define BT2_OFF LOW
#define BT3_ON  LOW
#define BT3_OFF HIGH

#define LED_PATTERN 200

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_OF_LED, LED_PIN, NEO_GRB + NEO_KHZ400);
SoftwareSerial mySerial(2, 3); // RX, TX

const uint8_t OFF_OFF_OFF[] = {BT1_OFF, BT2_OFF, BT3_OFF};
const uint8_t ON_OFF_OFF[]  = {BT1_ON,  BT2_OFF, BT3_OFF};
const uint8_t OFF_ON_OFF[]  = {BT1_OFF, BT2_ON,  BT3_OFF};
const uint8_t OFF_OFF_ON[]  = {BT1_OFF, BT2_OFF, BT3_ON };
const uint8_t ON_ON_OFF[]   = {BT1_ON,  BT2_ON,  BT3_OFF};
const uint8_t ON_OFF_ON[]   = {BT1_ON,  BT2_OFF, BT3_ON };
const uint8_t OFF_ON_ON[]   = {BT1_OFF, BT2_ON,  BT3_ON };
const uint8_t ON_ON_ON[]    = {BT1_ON,  BT2_ON,  BT3_ON };

const uint8_t LED_GASHAT_NAME[][3] PROGMEM = {
  {128,  0,  0},{  0,  0,  0},{128,  0,  0},{108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{  8,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{  0,  0,  0},{128,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{  0,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {120,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 64,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GAME_CLEAR[][3] PROGMEM = {
  {  0,  0, 12},{  0,  0, 24},{  0,  0, 32},{  0,  0, 48},{  0,  0, 60},{  0,  0, 72},{  0,  0, 84},{  0,  0, 96},{  0,  0,108},{  0,  0,120},
  {  0,  0, 96},{  0,  0, 72},{  0,  0, 48},{  0,  0, 24},{  0,  0,  0},{  0,  0, 12},{  0,  0, 24},{  0,  0, 32},{  0,  0, 48},{  0,  0, 60},
  {  0,  0, 72},{  0,  0, 84},{  0,  0, 96},{  0,  0,108},{  0,  0,120},{  0,  0, 96},{  0,  0, 72},{  0,  0, 48},{  0,  0, 24},{  0,  0,  0},
  {  0,  0, 12},{  0,  0, 24},{  0,  0, 32},{  0,  0, 48},{  0,  0, 60},{  0,  0, 72},{  0,  0, 84},{  0,  0, 96},{  0,  0,108},{  0,  0,120},
  {  0,  0, 96},{  0,  0, 72},{  0,  0, 48},{  0,  0, 24},{  0,  0,  0},{  0,  0, 12},{  0,  0, 24},{  0,  0, 32},{  0,  0, 48},{  0,  0, 60},
  {  0,  0, 72},{  0,  0, 84},{  0,  0, 96},{  0,  0,108},{  0,  0,120},{  0,  0, 96},{  0,  0, 72},{  0,  0, 48},{  0,  0, 24},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GAME_OVER[][3] PROGMEM = {
  {  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GASHAT_LEVEL1[][3] PROGMEM = {
  {128,  0,  0},{  0,  0,  0},{  0,  0,  0},{ 64,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{ 64,  0,  0},{128,  0,  0},
  {108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{  8,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 32,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{  0,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{  0,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{  0,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{ 32,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 64,  0,  0},
  { 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  { 12,  0,  0},{ 24,  0,  0},{ 36,  0,  0},{ 48,  0,  0},{ 60,  0,  0},{ 72,  0,  0},{ 84,  0,  0},{ 96,  0,  0},{108,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},
  { 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GASHAT_LEVEL2[][3] PROGMEM = {
  {128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{128,  0,  0},{108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{ 20,  0,  0},
  {  8,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},
  { 32,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},
  { 36,  0,  0},{ 18,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},
  {128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},
  {128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},
  {128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{128,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{ 32,  0,  0},{128,  0,  0},{ 32,  0,  0},{128,  0,  0},
  { 32,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GASHAT_LEVEL3[][3] PROGMEM = {
  {128,  0,  0},{ 64,  0,  0},{ 32,  0,  0},{128,  0,  0},{108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{ 20,  0,  0},
  {  8,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},
  { 32,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},
  { 36,  0,  0},{ 18,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},{128,128,  0},{128,128,  0},{ 64, 64,  0},{ 32, 32,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},
  {  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},
  {  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,128,  0},{  0,108,  0},{  0, 96,  0},{  0, 84,  0},{  0, 72,  0},{  0, 60,  0},
  {  0, 48,  0},{  0, 36,  0},{  0, 24,  0},{  0, 12,  0},{  0,  0,  0}
};

const uint8_t LED_GASHAT_IN[][3] PROGMEM = {
  {128,  0,  0},{  0,  0,  0},{  0,  0,  0},{ 64,  0,  0},{128,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{ 64,  0,  0},{128,  0,  0},
  {108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{  8,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GASHAT_OUT[][3] PROGMEM = {
  { 64,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{ 20,  0,  0},{  8,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_DRIVER_CLOSE[][3] PROGMEM = {
  {128,  0,  0},{  0,  0,  0},{128,  0,  0},{108,  0,  0},{ 88,  0,  0},{ 68,  0,  0},{ 48,  0,  0},{ 28,  0,  0},{ 20,  0,  0},{  8,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_CRITICAL_STRIKE[][3] PROGMEM = {
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},
  { 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},
  { 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},
  { 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 36,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,128},{  0,  0,128},
  { 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},{ 64,  0,128},{ 64,  0,128},{ 64,  0, 64},{ 64,  0, 64},{128,  0,128},{128,  0,128},
  {128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 64,  0,  0},{128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},
  {128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},{  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},
  {  0, 64,  0},{  0, 64,  0},{  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},{  0, 64, 64},{  0, 64, 64},{  0, 64,128},{128,  0,  0},
  { 64,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 36,  0,  0},
  { 24,  0,  0},{ 12,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_CRITICAL_READY[][3] PROGMEM = {
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{ 64,  0,  0},{ 64,  0,  0},{128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},{128, 128, 0},{128,128,  0},
  { 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},{  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},{  0, 64,  0},{  0, 64,  0},
  {  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},{  0, 64, 64},{  0, 64, 64},{  0, 64,128},{  0, 64,128},{  0,  0,128},{  0,  0,128},
  { 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},{ 64,  0,128},{ 64,  0,128},{ 64,  0, 64},{ 64,  0, 64},{128,  0,128},{128,  0,128},
  {128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 64,  0,  0},{128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},
  {128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},{  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},
  {  0, 64,  0},{  0, 64,  0},{  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},{  0, 64, 64},{  0, 64, 64},{  0, 64,128},{  0, 64,128},
  {  0,  0,128},{  0,  0,128},{ 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},{ 64,  0,128},{ 64,  0,128},{ 64,  0, 64},{ 64,  0, 64},
  {128,  0,128},{128,  0,128},{128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 64,  0,  0},{128, 64, 64},{128, 64, 64},
  {128, 64,  0},{128, 64,  0},{128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},{  0,128,  0},{  0,128,  0},
  { 64,128, 64},{ 64,128, 64},{  0, 64,  0},{  0, 64,  0},{  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},{  0, 64, 64},{  0, 64, 64},
  {  0, 64,128},{  0, 64,128},{  0,  0,128},{  0,  0,128},{ 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},{ 64,  0,128},{ 64,  0,128},
  { 64,  0, 64},{ 64,  0, 64},{128,  0,128},{128,  0,128},{128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 64,  0,  0},
  {128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},{128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},
  {  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},{  0, 64,  0},{  0, 64,  0},{  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},
  {  0, 64, 64},{  0, 64, 64},{  0, 64,128},{  0, 64,128},{  0,  0,128},{  0,  0,128},{ 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},
  { 64,  0,128},{ 64,  0,128},{ 64,  0, 64},{ 64,  0, 64},{128,  0,128},{128,  0,128},{128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},
  { 64,  0,  0},{ 64,  0,  0},{128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},{128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},
  { 64,128,  0},{ 64,128,  0},{  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},{  0, 64,  0},{  0, 64,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_CRITICAL_FINISH[][3] PROGMEM = {
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},
  { 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{128,  0,  0},{108,  0,  0},
  { 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{128,  0,  0},{128,  0,  0},
  {128,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 36,  0,  0},
  { 24,  0,  0},{ 12,  0,  0},{  0,  0,128},{  0,  0,128},{ 64, 64,128},{ 64, 64,128},{  0,  0, 64},{  0,  0, 64},{ 64,  0,128},{ 64,  0,128},
  { 64,  0, 64},{ 64,  0, 64},{128,  0,128},{128,  0,128},{128,  0, 64},{128,  0, 64},{128,  0,  0},{128,  0,  0},{ 64,  0,  0},{ 64,  0,  0},
  {128, 64, 64},{128, 64, 64},{128, 64,  0},{128, 64,  0},{128, 128, 0},{128,128,  0},{ 64, 64,  0},{ 64, 64,  0},{ 64,128,  0},{ 64,128,  0},
  {  0,128,  0},{  0,128,  0},{ 64,128, 64},{ 64,128, 64},{  0, 64,  0},{  0, 64,  0},{  0,128, 64},{  0,128, 64},{  0,128,128},{  0,128,128},
  {  0, 64, 64},{  0, 64, 64},{  0, 64,128},{128,  0,  0},{ 64,  0,  0},{128,  0,  0},{128,  0,  0},{108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},
  { 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 36,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

const uint8_t LED_GENRE[][3] PROGMEM = {
  { 64,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},{128,  0,  0},
  {108,  0,  0},{ 96,  0,  0},{ 84,  0,  0},{ 72,  0,  0},{ 60,  0,  0},{ 48,  0,  0},{ 32,  0,  0},{ 24,  0,  0},{ 12,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},
  {  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0},{  0,  0,  0}
};

void setup () {
  mySerial.begin (9600);
  mp3_set_serial (mySerial);  //set softwareSerial for DFPlayer-mini mp3 module 
  mp3_set_volume (25);

  pinMode(BUTTON_1_PIN, INPUT_PULLUP);
  pinMode(BUTTON_2_PIN, INPUT_PULLUP);
  pinMode(BUTTON_3_PIN, INPUT_PULLUP);

  pixels.begin();
  pixels.show();
}

uint8_t before_state[]  = {BT1_OFF, BT2_OFF, BT3_OFF};
uint8_t current_state[] = {BT1_OFF, BT2_OFF, BT3_OFF};
boolean single_mode_flag   = false;
boolean game_clear_flag    = false;
boolean critical_mode_flag = false;
uint8_t action = GASHAT_OFF;
uint8_t led_index = 0;

void loop(){
  current_state[0] = digitalRead(BUTTON_1_PIN);
  current_state[1] = digitalRead(BUTTON_2_PIN);
  current_state[2] = digitalRead(BUTTON_3_PIN);

  if(memcmp(before_state, OFF_OFF_OFF, N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      ;
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      action = set_action(LEVEL_1);
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_IN);
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      if(single_mode_flag == false){
        action = set_action(GASHAT_NAME);
      }else{
        if(game_clear_flag){
          action = set_action(GAME_CLEAR);
        }else{
          action = set_action(GAME_OVER);
        }
        game_clear_flag = !game_clear_flag;
      }
      single_mode_flag = !single_mode_flag;
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      action = set_action(GASHAT_IN);  
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      action = set_action(LEVEL_1); 
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      action = set_action(GASHAT_IN);  
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      if(critical_mode_flag == false){
        action = set_action(CRITICAL_READY);
      }else{
        action = set_action(CRITICAL_STRIKE);
      }
      critical_mode_flag = !critical_mode_flag;  
    }
  }else if(memcmp(before_state, ON_OFF_OFF, N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT); 
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      ;
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      ;
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      action = set_action(LEVEL_2);
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      action = set_action(LEVEL_2);  
    } 
  }else if(memcmp(before_state, OFF_ON_OFF, N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT); 
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      action = set_action(LEVEL_3);   
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      action = set_action(LEVEL_3);   
    } 
  }else if(memcmp(before_state, OFF_OFF_ON, N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      ;  
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      action = set_action(LEVEL_1);   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      action = set_action(GASHAT_IN); 
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      if(critical_mode_flag == false){
        action = set_action(CRITICAL_READY);
      }else{
        action = set_action(CRITICAL_STRIKE);
      }
      critical_mode_flag = !critical_mode_flag;  
    } 
  }else if(memcmp(before_state, ON_ON_OFF,  N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      action = set_action(DRIVER_CLOSE); 
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      action = set_action(DRIVER_CLOSE);
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      if(critical_mode_flag == false){
        action = set_action(CRITICAL_READY);
      }else{
        action = set_action(CRITICAL_STRIKE);
      }
      critical_mode_flag = !critical_mode_flag;   
    }  
  }else if(memcmp(before_state, ON_OFF_ON,  N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);  
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      action = set_action(LEVEL_2); 
    } 
  }else if(memcmp(before_state, OFF_ON_ON,  N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);   
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      ;   
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      action = set_action(LEVEL_3);    
    } 
  }else if(memcmp(before_state, ON_ON_ON,   N_BUTTON) == 0){
    if(memcmp(current_state, OFF_OFF_OFF, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);  
    }else if(memcmp(current_state, ON_OFF_OFF, N_BUTTON) == 0){
      action = set_action(CRITICAL_FINISH);   
    }else if(memcmp(current_state, OFF_ON_OFF, N_BUTTON) == 0){
      action = set_action(GENRE); 
    }else if(memcmp(current_state, OFF_OFF_ON, N_BUTTON) == 0){
      action = set_action(GASHAT_OUT);   
    }else if(memcmp(current_state, ON_ON_OFF,  N_BUTTON) == 0){
      ;  
    }else if(memcmp(current_state, ON_OFF_ON,  N_BUTTON) == 0){
      action = set_action(CRITICAL_FINISH);  
    }else if(memcmp(current_state, OFF_ON_ON,  N_BUTTON) == 0){
      action = set_action(GENRE);  
    }else if(memcmp(current_state, ON_ON_ON,   N_BUTTON) == 0){
      ;   
    } 
  }

  flash_led(action);

  before_state[0] = current_state[0];
  before_state[1] = current_state[1];
  before_state[2] = current_state[2];

  delay(100);
}

uint8_t set_action(uint8_t action){
  mp3_play(action);
  led_index = 0;
  return action;
}

void flash_led(uint8_t action){
  switch(action){
  case GASHAT_NAME:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_NAME[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_NAME[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_NAME[led_index][2]))));
    break;
  case GAME_CLEAR:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GAME_CLEAR[led_index][0])),
                                         pgm_read_byte(&(LED_GAME_CLEAR[led_index][1])),
                                         pgm_read_byte(&(LED_GAME_CLEAR[led_index][2]))));
    break;
  case GAME_OVER:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GAME_OVER[led_index][0])),
                                         pgm_read_byte(&(LED_GAME_OVER[led_index][1])),
                                         pgm_read_byte(&(LED_GAME_OVER[led_index][2]))));
    break;
  case LEVEL_1:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_LEVEL1[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL1[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL1[led_index][2]))));
    break;
  case LEVEL_2:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_LEVEL2[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL2[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL2[led_index][2]))));
    break;
  case LEVEL_3:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_LEVEL3[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL3[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_LEVEL3[led_index][2]))));
    break;
  case GASHAT_IN:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_IN[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_IN[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_IN[led_index][2]))));
    break;
  case GASHAT_OUT:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GASHAT_OUT[led_index][0])),
                                         pgm_read_byte(&(LED_GASHAT_OUT[led_index][1])),
                                         pgm_read_byte(&(LED_GASHAT_OUT[led_index][2]))));
    break;
  case DRIVER_CLOSE:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_DRIVER_CLOSE[led_index][0])),
                                         pgm_read_byte(&(LED_DRIVER_CLOSE[led_index][1])),
                                         pgm_read_byte(&(LED_DRIVER_CLOSE[led_index][2]))));
    break;
  case CRITICAL_STRIKE:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_CRITICAL_STRIKE[led_index][0])),
                                         pgm_read_byte(&(LED_CRITICAL_STRIKE[led_index][1])),
                                         pgm_read_byte(&(LED_CRITICAL_STRIKE[led_index][2]))));
    break;
  case CRITICAL_READY:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_CRITICAL_READY[led_index][0])),
                                         pgm_read_byte(&(LED_CRITICAL_READY[led_index][1])),
                                         pgm_read_byte(&(LED_CRITICAL_READY[led_index][2]))));
    break;
  case CRITICAL_FINISH:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_CRITICAL_FINISH[led_index][0])),
                                         pgm_read_byte(&(LED_CRITICAL_FINISH[led_index][1])),
                                         pgm_read_byte(&(LED_CRITICAL_FINISH[led_index][2]))));
    break;
  case GENRE:
    pixels.setPixelColor(0, pixels.Color(pgm_read_byte(&(LED_GENRE[led_index][0])),
                                         pgm_read_byte(&(LED_GENRE[led_index][1])),
                                         pgm_read_byte(&(LED_GENRE[led_index][2]))));
    break;
  case GASHAT_OFF:
  default:
    pixels.setPixelColor(0, pixels.Color(0,0,0));
  }

  if(led_index < LED_PATTERN){
    led_index++;
  }else{
    pixels.setPixelColor(0, pixels.Color(0,0,0));
  }

  pixels.show();
}

以上がマリオガシャットの仕組みです。思うに、ボタン1と2の処理がイマイチなので、ここがもう少し改善されたら、もっと遊びやすくなると思います。

That’s all for my explanation. I think the design for button switch 1 & 2 is not good. If you can refine it, your gashat becomes robuster and you can enjoy it more!