diff --git a/anims.h b/anims.h index 9b809b6..e95b5b8 100644 --- a/anims.h +++ b/anims.h @@ -170,3 +170,76 @@ void emotePensive() { } } } + +void emoteYes() { + mode = DISP_MODE_EMOTEYES; + for(int i = 0; i < 13; i++){ + switch(i){ + case 0: + case 4: + case 8: + case 12: + display_bitmap(1); + if(i == 0 || i == 4 || i == 8) ynSnd1(); + break; + case 1: + case 3: + case 5: + case 7: + case 9: + case 11: + display_bitmap_delay(26, 80); + break; + case 2: + case 6: + case 10: + display_bitmap(27); + ynSnd2(); + break; + default: + display_bitmap_delay(0, 100); + break; + } + } +} + + +void emoteNo() { + mode = DISP_MODE_EMOTENO; + for(int i = 0; i < 17; i++){ + switch(i){ + case 0: + case 4: + case 8: + case 12: + case 16: + display_bitmap_delay(30, 50); + break; + case 1: + case 3: + case 9: + case 11: + display_bitmap_delay(29, 50); + break; + case 2: + case 10: + display_bitmap(28); + ynSnd2(); + break; + case 5: + case 7: + case 13: + case 15: + display_bitmap_delay(31, 50); + break; + case 6: + case 14: + display_bitmap_delay(32, 50); + ynSnd1(); + break; + default: + display_bitmap_delay(0, 100); + break; + } + } +} diff --git a/bitmapData.h b/bitmapData.h index 23a9e76..5435fd9 100644 --- a/bitmapData.h +++ b/bitmapData.h @@ -2,16 +2,16 @@ const unsigned char bmpDat[][168] PROGMEM = { { // 0 boot 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x18, 0x18, 0x38, 0x30, 0x31, 0x01, 0x01, 0x00, 0x00, 0x18, 0x1c, 0x0e, 0x06, 0x07, 0x03, 0x03, - 0x03, 0x7f, 0x7f, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0x28, 0x57, 0x57, 0x00, 0x1f, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x63, 0x63, 0x63, 0x63, 0x60, 0x70, - 0x30, 0x38, 0x1c, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x66, 0x6e, 0x7c, 0x7c, 0x6e, 0x66, 0x00, 0x00, - 0x42, 0x5a, 0x7e, 0x7e, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xf8, 0xc0, 0x00, 0x3c, - 0xfc, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x80, 0x80, 0xf8, 0xf8, 0x00, 0x00, 0x00, - 0xc0, 0xfc, 0xbc, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x9c, 0xbc, 0xd8, - 0xe0, 0x70, 0x38, 0xf8, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0x38, 0x1c, 0x0c, 0x0e, - 0x06, 0x06, 0x86, 0x80, 0x0a, 0x0a, 0x14, 0x00 + 0x18, 0x18, 0x38, 0x30, 0x31, 0x01, 0x01, 0x00, 0x00, 0x18, 0x1c, 0x0e, 0x06, 0x07, 0x03, 0x03, + 0x03, 0x7f, 0x7f, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x28, 0x57, 0x57, 0x00, 0x1f, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x63, 0x63, 0x63, 0x63, 0x60, + 0x70, 0x30, 0x38, 0x1c, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x66, 0x6e, 0x7c, 0x7c, 0x6e, 0x66, 0x00, + 0x00, 0x42, 0x5a, 0x7e, 0x7e, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xf8, 0xc0, 0x00, 0x3c, + 0xfc, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x80, 0x80, 0xf8, 0xf8, 0x00, 0x00, 0x00, + 0xc0, 0xfc, 0xbc, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x9c, 0xbc, 0xd8, + 0xe0, 0x70, 0x38, 0xf8, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0x38, 0x1c, 0x0c, 0x0e, + 0x06, 0x06, 0x86, 0x80, 0x0a, 0x0a, 0x14, 0x00 }, { // 1 main, yes1 @@ -126,13 +126,13 @@ const unsigned char bmpDat[][168] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { // 9 infoscreen - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x84, 0xb5, 0xb7, 0x94, 0x62, 0x00, + 0x2b, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x84, 0xb5, 0xb7, 0x94, 0x62, 0x00, 0x78, 0x3c, 0x7e, 0x7f, 0x6f, 0x46, 0x00, 0x00, 0x00, 0xa4, 0xaa, 0xca, 0xa4, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc9, 0xaa, 0xaa, 0xa1, 0xc8, 0x24, 0x71, 0x25, 0x25, 0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x25, 0x53, 0x55, 0x25, 0x00, 0x00, 0x00, 0x01, 0xa8, 0x01, 0xc0, 0x80, 0x00, - 0x00, 0x00, 0x29, 0x92, 0x92, 0x29, 0x00, 0x80, 0x80, 0x40, 0xd4, 0x54, 0x56, 0xc5, 0x10, 0x00, - 0x80, 0xc0, 0xe0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x29, 0xc9, 0x65, 0x00, 0x00, 0x11, - 0x15, 0x1b, 0x00, 0xc6, 0x2a, 0xca, 0x6a, 0x00, 0x00, 0x63, 0x75, 0x15, 0x65, 0x00, 0x12, 0x0e, + 0x00, 0x00, 0x29, 0x92, 0x92, 0x29, 0x00, 0x80, 0x54, 0x56, 0xc5, 0x10, 0x00, 0x80, 0xc0, 0xe0, + 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x29, 0xc9, 0x65, 0x00, 0x00, 0x11, 0x15, 0x1b, 0x00, + 0x00, 0x00, 0x00, 0xc6, 0x2a, 0xca, 0x6a, 0x00, 0x00, 0x63, 0x75, 0x15, 0x65, 0x00, 0x12, 0x0e, 0x52, 0x00, 0x08, 0x62, 0xa9, 0xa8, 0x68, 0x20, 0xd8, 0x48, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x42, 0x42, 0x42, 0xe2, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x64, 0x54, 0x54, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xb6, 0x00, 0x10, 0x20, 0x20, 0x70, 0x20, 0x00, 0xfc, @@ -392,7 +392,7 @@ const unsigned char bmpDat[][168] PROGMEM = { }, { // 28 no1 - 0x60, 0x00, 0x60, 0x90, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0x07, + 0x06, 0x00, 0x06, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0x07, 0xf1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x28, 0x11, 0x03, 0x07, 0x0e, 0x1c, 0x38, 0x38, 0x1e, 0x0f, @@ -406,7 +406,7 @@ const unsigned char bmpDat[][168] PROGMEM = { }, { // 29 no2 - 0x30, 0x00, 0x30, 0x48, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf3, 0x03, + 0x0c, 0x00, 0x0c, 0x12, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf3, 0x03, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x51, 0x23, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0x70, 0x3c, 0x1f, @@ -434,7 +434,7 @@ const unsigned char bmpDat[][168] PROGMEM = { }, { // 31 no4 - 0x0c, 0x00, 0x0c, 0x12, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x00, + 0x30, 0x00, 0x30, 0x48, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x00, 0xfc, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x23, 0x47, 0x8e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0xc0, 0xf0, 0x7c, @@ -448,7 +448,7 @@ const unsigned char bmpDat[][168] PROGMEM = { }, { // 32 no5 - 0x06, 0x00, 0x06, 0x09, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00, + 0x60, 0x00, 0x60, 0x90, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x46, 0x8e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0x80, 0x80, 0xe0, 0xf8, diff --git a/chained_bmp/boot1.png b/chained_bmp/boot1.png index 0b73d73..9cacb9e 100644 Binary files a/chained_bmp/boot1.png and b/chained_bmp/boot1.png differ diff --git a/chained_bmp/info_chained.png b/chained_bmp/info_chained.png index 09db39d..aa13416 100644 Binary files a/chained_bmp/info_chained.png and b/chained_bmp/info_chained.png differ diff --git a/chained_bmp/no1_chained.png b/chained_bmp/no1_chained.png index 4cf9548..7438a34 100644 Binary files a/chained_bmp/no1_chained.png and b/chained_bmp/no1_chained.png differ diff --git a/chained_bmp/no2_chained.png b/chained_bmp/no2_chained.png index c99589e..8d60f64 100644 Binary files a/chained_bmp/no2_chained.png and b/chained_bmp/no2_chained.png differ diff --git a/chained_bmp/no4_chained.png b/chained_bmp/no4_chained.png index b779019..dcbb5d6 100644 Binary files a/chained_bmp/no4_chained.png and b/chained_bmp/no4_chained.png differ diff --git a/chained_bmp/no5_chained.png b/chained_bmp/no5_chained.png index 7bb338e..d988d0f 100644 Binary files a/chained_bmp/no5_chained.png and b/chained_bmp/no5_chained.png differ diff --git a/digitsune.h b/digitsune.h index 8d17594..eb52916 100644 --- a/digitsune.h +++ b/digitsune.h @@ -12,8 +12,19 @@ #define DISP_DEBUG false #define TEAL 0b0000011111110000 +#define TEAL32 0b00000000000000001111111110000000 #define PINK 0b1111100000010000 +#define PINK32 0b00000000111111110000000010000000 +#define PURPLE 0b1111100000011111 +#define PURPLE32 0b00000000010000000000000011111100 +#define RED 0b1111100000000000 +#define RED32 0b00000000111111110000000000000000 +#define GREEN 0b0000011111100000 +#define GREEN32 0b00000000000000001111111100000000 +#define BLUE 0b0000000000011111 +#define BLUE32 0b00000000000000000000000011111111 #define WHITE 0b1111111111111111 +#define WHITE32 0b00000000111111111111111111111111 #define RMT_MAIN 0x40BF708F #define RMT_VOICE 0x40BFD02F @@ -28,7 +39,11 @@ #define RMT_COLTEAL 0x40BF20DF #define RMT_COLPINK 0x40BF40BF #define RMT_COLPURPLE 0x40BFC03F -#define RMT_DEBUG true +#define RMT_COLRED 0x40BFE01F +#define RMT_COLGREEN 0x40BF609F +#define RMT_COLBLUE 0x40BFA05F +#define RMT_COLWHITE 0x40BF10EF +#define RMT_DEBUG false enum DISP_MODE { DISP_MODE_MAIN, diff --git a/digitsune.ino b/digitsune.ino index 24420e6..be28491 100644 --- a/digitsune.ino +++ b/digitsune.ino @@ -1,7 +1,9 @@ #include "anims.h" Adafruit_NeoMatrix *matrix = new Adafruit_NeoMatrix(DISP_WIDTH, DISP_HEIGHT, DISP_PIN, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800); +Adafruit_NeoPixel *earPix = new Adafruit_NeoPixel(2, 9, NEO_GRB + NEO_KHZ800); uint16_t curColor = TEAL; +uint32_t curColor32 = TEAL32; void display_bitmap(uint8_t bmp_num) { // Clear prior bitmap first @@ -19,6 +21,11 @@ void display_bitmap_delay(uint8_t bmp_num, uint16_t time){ delay(time); } +void setEarColor(uint32_t col){ + earPix->fill(col, 0, 2); + earPix->show(); +} + // Measurepeak function float measurePeak(uint32_t milliseconds) { float soundMax = 0; @@ -111,11 +118,11 @@ void loop() { break; case RMT_EMOTEYES: modeBlip(); - //emoteHappy(); + emoteYes(); break; case RMT_EMOTENO: modeBlip(); - //emoteHappy(); + emoteNo(); break; case RMT_INFO: modeBlip(); @@ -125,11 +132,43 @@ void loop() { modeBlip(); curColor = TEAL; display_bitmap(currentBitmap); + setEarColor(TEAL32); break; case RMT_COLPINK: modeBlip(); curColor = PINK; display_bitmap(currentBitmap); + setEarColor(PINK32); + break; + case RMT_COLPURPLE: + modeBlip(); + curColor = PURPLE; + display_bitmap(currentBitmap); + setEarColor(PURPLE32); + break; + case RMT_COLRED: + modeBlip(); + curColor = RED; + display_bitmap(currentBitmap); + setEarColor(RED32); + break; + case RMT_COLGREEN: + modeBlip(); + curColor = GREEN; + display_bitmap(currentBitmap); + setEarColor(GREEN32); + break; + case RMT_COLBLUE: + modeBlip(); + curColor = BLUE; + display_bitmap(currentBitmap); + setEarColor(BLUE32); + break; + case RMT_COLWHITE: + modeBlip(); + curColor = WHITE; + display_bitmap(currentBitmap); + setEarColor(WHITE32); break; } @@ -142,15 +181,17 @@ void setup() { #endif CircuitPlayground.begin(); matrix->begin(); + earPix->begin(); matrix->setBrightness(DISP_BRIGHTNESS); CircuitPlayground.speaker.enable(true); CircuitPlayground.irReceiver.enableIRIn(); - + #if DISP_DEBUG matrix->fillScreen(TEAL); matrix->show(); #else // if not debugging the display, show the boot img and then main display_bitmap(0); + setEarColor(TEAL32); happyChirp(); //sng1(); delay(1000); diff --git a/sfx.h b/sfx.h index 9baa278..41b78c7 100644 --- a/sfx.h +++ b/sfx.h @@ -102,16 +102,6 @@ void happyChirp() { CircuitPlayground.playTone(7000, 25); } -void sadChirp() { - CircuitPlayground.playTone(1500, 25); - CircuitPlayground.playTone(3500, 25); - CircuitPlayground.playTone(5500, 25); - delay(125); - CircuitPlayground.playTone(500, 25); - CircuitPlayground.playTone(2500, 25); - CircuitPlayground.playTone(4500, 25); -} - void errChirp() { CircuitPlayground.playTone(500, 15); CircuitPlayground.playTone(2500, 15); @@ -141,6 +131,14 @@ void sighOut() { } } +void ynSnd1() { + CircuitPlayground.playTone(500, 80); +} + +void ynSnd2() { + CircuitPlayground.playTone(1000, 80); +} + void sng1() { int len[13] = {1, 1, 16, 3, 3, 2, 4, 4, 4, 1, 4, 2, 14}; int note[13] = {NOTE_F4, NOTE_E4, NOTE_F4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_E4, NOTE_C4, NOTE_A3, NOTE_C4, NOTE_E4, NOTE_F4, NOTE_D4};