part 1
// This Program is for the Cheap Dinosaurs backing track player.
// We have had some issues in the past with extremely failable vintage equipment.
// We wanted something with modern functionality and a modern flare.
// We wanted to use a Genesis controller but playback high quality wav, ogg or midi.
// It also had to be durable. Above all else we needed something that could
// withstand high heat levels under stage lighting and also deliver great sound quality.
// equipment to use with this code:
// Arduino Mega 2560, Adafruit VS1053 Shield, Adafruit I2C LCD kit
// DB9 module, Genesis 3-Button Controller, Jumpers, Stacking Headers, Enclosure, etc.
// GENESIS 3-BUTTON LIBRARY + OBJECT
// modified library: inputs have been relocated to pins 22-28
// DB9 module used to interface with the Genesis Controller
#include <GenesisGamepad.h>
GenesisGamepad thr33Button; // create the controller jawn
// MUSIC SHIELD SHITE
// include SPI, MP3, and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the music maker shield
#define SHIELD_RESET 9 // VS1053 reset pin (output)
#define SHIELD_CS 7 // VS1053 chip select pin (output)
#define SHIELD_DCS 6 // VS1053 Data/command select pin (output)
#define CARDCS 4 // Card chip select pin
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin
Adafruit_VS1053_FilePlayer musicPlayer = // create breakout-example object
Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS); // create shield-example object
// LOAD LCD LIBRARY + PIXEL ART
#include <Wire.h> // for the I2C 2-wire (SDA,SCL) connection
#include <Adafruit_MCP23017.h> // for buttons on shield
#include <Adafruit_RGBLCDShield.h> // make screen work
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
// pixel art for the transport
byte previous[8] = {
B10011,
B10111,
B11111,
B10111,
B10011,
B00000,
B00000,
};
byte rewind[8] = {
B00101,
B01111,
B11111,
B01111,
B00101,
B00000,
B00000,
};
byte fastForward[8] = {
B10100,
B11110,
B11111,
B11110,
B10100,
B00000,
B00000,
};
byte next[8] = {
B11001,
B11101,
B11111,
B11101,
B11001,
B00000,
B00000,
};
byte play[8] = {
B11000,
B11100,
B11110,
B11100,
B11000,
B00000,
B00000,
};
byte st0p[8] = {
B01110,
B11111,
B11111,
B11111,
B01110,
B00000,
B00000,
};
byte pause[8] = {
B10010,
B10010,
B10010,
B10010,
B10010,
B00000,
B00000,
};
byte heart[8] = {
B10101,
B01110,
B11111,
B01110,
B10101,
B00000,
B00000,
};
int loadDelay = 100;
int deBounce = 300;
boolean pauseFlag = true;
long cReading = 0; // this needs to be a long to store the huge millis() number as time goes on
boolean canPawz = false;
long shieldUpReading = 0
void setup() {
// begin serial monitor for debugging + talking to the console
Serial.begin(9600);
// FOR GENESIS CONTROLLER
thr33Button.init();
// LCD SHITE
// set up the LCD's number of columns and rows:
lcd.begin(16, 2); // btw THIS HAS to be first.
// IDEA!! uint16_t decodeTime(void) - Reads the DECODETIME register from the chip.
// load PixelArtBytes™ into LCD's createChar variable
lcd.createChar(0, previous);
lcd.createChar(1, rewind);
lcd.createChar(2, fastForward);
lcd.createChar(3, next);
lcd.createChar(4, play);
lcd.createChar(5, st0p);
lcd.createChar(6, pause);
lcd.createChar(7, heart);
// draw transport
lcd.setCursor(0,0);
lcd.write(byte(0)); // previous chr
delay(loadDelay);
lcd.setCursor(2, 0);
lcd.write(byte(1)); // rewind chr
delay(loadDelay);
lcd.setCursor(4, 0);
lcd.write(byte(2)); // fast forward chr
delay(loadDelay);
lcd.setCursor(6, 0);
lcd.write(byte(3)); // next chr
delay(200);
lcd.setCursor(11, 0);
lcd.write(byte(4)); // play chr
delay(loadDelay);
lcd.setCursor(13, 0);
lcd.write(byte(5)); // stop chr
delay(loadDelay);
lcd.setCursor(15, 0);
lcd.write(byte(6)); // pause chr
// FOR MUSIC PLAYBACK
Serial.println("Welcome to your Doom");
if (! musicPlayer.begin()) { // initialise the music player
Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
while (1);
}
Serial.println(F("VS1053 found"));
SD.begin(CARDCS); // initialise the SD card
musicPlayer.setVolume(0,0); // lower numbers == louder volume!
musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int
}
void loop() {
threeButtonKeys();
shieldKeys();
}