Created
June 12, 2023 17:22
-
-
Save toozie21/9638c8c5bde5865e8cfd9942285712c5 to your computer and use it in GitHub Desktop.
Skippy and the Skulls Arduino Nano header file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _TALKINGSKULL_H | |
#define _TALKINGSKULL_H | |
#define NOP __asm__ __volatile__ ("nop\n\t") | |
const char compile_date[] = __DATE__ " " __TIME__; | |
uint8_t song_total = 15; | |
char song_list[] = {'1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; | |
const char menu_title[] PROGMEM = "Which song?"; | |
const char song1[] PROGMEM = "1 - In Heaven There Is No beer"; | |
const char song2[] PROGMEM = "2 - Skel Dance Joke"; | |
const char song3[] PROGMEM = "3 - Oogie Boogie Man"; | |
const char song4[] PROGMEM = "4 - Funny Bone Joke"; | |
const char song5[] PROGMEM = "5 - The Time Warp"; | |
const char song6[] PROGMEM = "6 - Lying Ghost Joke"; | |
const char song7[] PROGMEM = "7 - Monster Mash"; | |
const char song8[] PROGMEM = "8 - Ice Scream Joke"; | |
const char song9[] PROGMEM = "9 - The Addams Family"; | |
const char song10[] PROGMEM = "a - Skel Cross Road Joke"; | |
const char song11[] PROGMEM = "b - Werewolves of London"; | |
const char song12[] PROGMEM = "c - Ghostbusters"; | |
const char song13[] PROGMEM = "d - Purple People Eaters"; | |
const char song14[] PROGMEM = "e - I Put a Spell on You"; | |
const char song15[] PROGMEM = "f - I Want Candy"; | |
const char volume_control[] PROGMEM = "g - get/set the volume"; | |
const char *const menu_table[] PROGMEM = {menu_title, song1, song2, song3, song4, song5, song6, song7, song8, song9, song10, song11, song12, song13, song14, song15, volume_control}; | |
const char menu_title2[] PROGMEM = "Which servo are you reading/writing?"; | |
const char head[] PROGMEM = "1 - Skippy's Head"; | |
const char jaw_1[] PROGMEM = "2 - Skippy's Jaw"; | |
const char jaw_2[] PROGMEM = "3 - Joe's Jaw"; | |
const char jaw_3[] PROGMEM = "4 - Stush's Jaw"; | |
const char jaw_4 [] PROGMEM = "5 - Rosie's Jaw"; | |
const char jaw_2_3[] PROGMEM = "6 - Joe and Stush's Jaw"; | |
const char jaw_2_3_4 [] PROGMEM = "7 - All Jaws"; | |
const char init_file [] PROGMEM = "8 - Init a file (if w); play all (if r)"; | |
const char *const menu_table2[] PROGMEM = {menu_title2, head, jaw_1, jaw_2, jaw_3, jaw_4, jaw_2_3, jaw_2_3_4, init_file}; | |
//declare reset function @ address 0 | |
void(* resetApp) (void) = 0; | |
//prepping for the TIMER1 stuff | |
volatile bool TIMER1_OF = false; | |
//the file descriptor for reading/writing | |
File myFile; | |
///////servo stuff | |
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); | |
int roll_ADC = A0; | |
int pitch_ADC = A1; | |
int yaw_ADC = A2; | |
int jaw_ADC = A3; | |
int pitch_servo = 0; | |
int roll_servo = 1; | |
int yaw_servo = 2; | |
int jaw_1_servo = 3; | |
int jaw_2_servo = 4; | |
int jaw_3_servo = 5; | |
int jaw_4_servo = 6; | |
uint16_t MIN_PULSE_WIDTH_YAW = 185; //lower number and he bumps into stush | |
uint16_t DEF_PULSE_WIDTH_YAW = 245; | |
uint16_t MAX_PULSE_WIDTH_YAW = 295; //higher number and he bumps into rosie | |
uint16_t MIN_PULSE_WIDTH_PITCH = 205; | |
uint16_t DEF_PULSE_WIDTH_PITCH = 290; | |
uint16_t MAX_PULSE_WIDTH_PITCH = 370; | |
uint16_t MIN_PULSE_WIDTH_ROLL = 105; | |
uint16_t DEF_PULSE_WIDTH_ROLL = 158; | |
uint16_t MAX_PULSE_WIDTH_ROLL = 220; | |
uint16_t MAX_PULSE_WIDTH_JAW_1 = 300;//215;//250; //open | |
uint16_t MIN_PULSE_WIDTH_JAW_1 = 90;//335;//350; //closed | |
//Joe, Port4 | |
uint16_t MIN_PULSE_WIDTH_JAW_2 = 110;//closed | |
uint16_t MAX_PULSE_WIDTH_JAW_2 = 240;//open | |
uint16_t MIN_PULSE_WIDTH_JAW_3 = 110; | |
uint16_t MAX_PULSE_WIDTH_JAW_3 = 240; | |
uint16_t MIN_PULSE_WIDTH_JAW_4 = 110; | |
uint16_t MAX_PULSE_WIDTH_JAW_4 = 240; | |
#define FREQUENCY 50 | |
//#define NUM_SERVOS 7 | |
#define HEAD_OFFSET 0 | |
#define JAW1_OFFSET 6 | |
#define JAW2_OFFSET 8 | |
#define JAW3_OFFSET 10 | |
#define JAW4_OFFSET 12 | |
///////end servo stuff | |
const int PLAY_BTN = 9; | |
bool auto_play = false; | |
//////mp3 stuff | |
const int VOLUME_ADDR = 0; | |
const int SONG_ADDR = 2; | |
const int SET_VOLUME = 18;//25; | |
const int BUSY = 8; //busy signal from MP3 player when playing a track | |
// implement a notification class, its member methods will get called | |
class Mp3Notify | |
{ | |
public: | |
static void OnError(uint16_t errorCode) | |
{ | |
// see DfMp3_Error for code meaning | |
Serial.println(); | |
Serial.print(F("Com Error ")); | |
Serial.println(errorCode); | |
} | |
static void OnPlayFinished(uint16_t globalTrack) | |
{ | |
Serial.println(); | |
Serial.print(F("Play finished for #")); | |
Serial.println(globalTrack); | |
} | |
static void OnCardOnline(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("Card online ")); | |
Serial.println(code); | |
} | |
static void OnUsbOnline(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("USB Disk online ")); | |
Serial.println(code); | |
} | |
static void OnCardInserted(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("Card inserted ")); | |
Serial.println(code); | |
} | |
static void OnUsbInserted(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("USB Disk inserted ")); | |
Serial.println(code); | |
} | |
static void OnCardRemoved(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("Card removed ")); | |
Serial.println(code); | |
} | |
static void OnUsbRemoved(uint16_t code) | |
{ | |
Serial.println(); | |
Serial.print(F("USB Disk removed ")); | |
Serial.println(code); | |
} | |
}; | |
SoftwareSerial secondarySerial(6, 7); // RX, TX | |
DFMiniMp3<SoftwareSerial, Mp3Notify> mp3(secondarySerial); | |
//////mp3 stuff | |
#endif // _TALKINGSKULL_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment