ENIB 2024 : Bass Hero : Différence entre versions

De Les Fabriques du Ponant
Aller à : navigation, rechercher
(Code Arduino)
(Code Arduino)
Ligne 39 : Ligne 39 :
 
<syntaxhighlight lang="Arduino" line>  
 
<syntaxhighlight lang="Arduino" line>  
  
#define test
+
#include <Adafruit_GFX.h>
 +
#include <Adafruit_NeoMatrix.h>
 +
#include <Adafruit_NeoPixel.h>
 +
 
 +
#define NOTE_B0  31
 +
#define NOTE_C1  33
 +
#define NOTE_CS1 35
 +
#define NOTE_D1  37
 +
#define NOTE_DS1 39
 +
#define NOTE_E1  41
 +
#define NOTE_F1  44
 +
#define NOTE_FS1 46
 +
#define NOTE_G1  49
 +
#define NOTE_GS1 52
 +
#define NOTE_A1  55
 +
#define NOTE_AS1 58
 +
#define NOTE_B1  62
 +
#define NOTE_C2  65
 +
#define NOTE_CS2 69
 +
#define NOTE_D2  73
 +
#define NOTE_DS2 78
 +
#define NOTE_E2  82
 +
#define NOTE_F2  87
 +
#define NOTE_FS2 93
 +
#define NOTE_G2  98
 +
#define NOTE_GS2 104
 +
#define NOTE_A2  110
 +
#define NOTE_AS2 117
 +
#define NOTE_B2  123
 +
#define NOTE_C3  131
 +
#define NOTE_CS3 139
 +
#define NOTE_D3  147
 +
#define NOTE_DS3 156
 +
#define NOTE_E3  165
 +
#define NOTE_F3  175
 +
#define NOTE_FS3 185
 +
#define NOTE_G3  196
 +
#define NOTE_GS3 208
 +
#define NOTE_A3  220
 +
#define NOTE_AS3 233
 +
#define NOTE_B3  247
 +
#define NOTE_C4  262
 +
#define NOTE_CS4 277
 +
#define NOTE_D4  294
 +
#define NOTE_DS4 311
 +
#define NOTE_E4  330
 +
#define NOTE_F4  349
 +
#define NOTE_FS4 370
 +
#define NOTE_G4  392
 +
#define NOTE_GS4 415
 +
#define NOTE_A4  440
 +
#define NOTE_AS4 466
 +
#define NOTE_B4  494
 +
#define NOTE_C5  523
 +
#define NOTE_CS5 554
 +
#define NOTE_D5  587
 +
#define NOTE_DS5 622
 +
#define NOTE_E5  659
 +
#define NOTE_F5  698
 +
#define NOTE_FS5 740
 +
#define NOTE_G5  784
 +
#define NOTE_GS5 831
 +
#define NOTE_A5  880
 +
#define NOTE_AS5 932
 +
#define NOTE_B5  988
 +
#define NOTE_C6  1047
 +
#define NOTE_CS6 1109
 +
#define NOTE_D6  1175
 +
#define NOTE_DS6 1245
 +
#define NOTE_E6  1319
 +
#define NOTE_F6  1397
 +
#define NOTE_FS6 1480
 +
#define NOTE_G6  1568
 +
#define NOTE_GS6 1661
 +
#define NOTE_A6  1760
 +
#define NOTE_AS6 1865
 +
#define NOTE_B6  1976
 +
#define NOTE_C7  2093
 +
#define NOTE_CS7 2217
 +
#define NOTE_D7  2349
 +
#define NOTE_DS7 2489
 +
#define NOTE_E7  2637
 +
#define NOTE_F7  2794
 +
#define NOTE_FS7 2960
 +
#define NOTE_G7  3136
 +
#define NOTE_GS7 3322
 +
#define NOTE_A7  3520
 +
#define NOTE_AS7 3729
 +
#define NOTE_B7  3951
 +
#define NOTE_C8  4186
 +
#define NOTE_CS8 4435
 +
#define NOTE_D8  4699
 +
#define NOTE_DS8 4978
 +
#define REST      0
 +
 
 +
#define PIN 8
 +
#define BTN_X 2
 +
#define BTN_Y 3
 +
#define BTN_Z 4
 +
#define BTN_W 5
 +
#ifndef PSTR
 +
#define PSTR // Make Arduino Due happy
 +
#endif
 +
 
 +
// change this to whichever pin you want to use
 +
int buzzer = 11;
 +
 
 +
int music[] = {1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,
 +
              0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,
 +
              0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,
 +
              0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,};
 +
int tempo = 100;
 +
//int wholenote = (60000 * 4) / tempo;
 +
 
 +
// notes of the moledy followed by the duration.
 +
// a 4 means a quarter note, 8 an eighteenth , 16 sixteenth, so on
 +
// !!negative numbers are used to represent dotted notes,
 +
// so -4 means a dotted quarter note, that is, a quarter plus an eighteenth!!
 +
/*int melody[] = {
 +
 
 +
  // Nokia Ringtone
 +
  // Score available at https://musescore.com/user/29944637/scores/5266155
 +
 
 +
  NOTE_E5, 8, NOTE_D5, 8, NOTE_FS4, 4, NOTE_GS4, 4,
 +
  NOTE_CS5, 8, NOTE_B4, 8, NOTE_D4, 4, NOTE_E4, 4,
 +
  NOTE_B4, 8, NOTE_A4, 8, NOTE_CS4, 4, NOTE_E4, 4,
 +
  NOTE_A4, 2,
 +
};*/
 +
int melody[] = {
 +
 
 +
  // Song of storms - The Legend of Zelda Ocarina of Time.
 +
  // Score available at https://musescore.com/user/4957541/scores/1545401
 +
 
 +
  NOTE_D4,4, NOTE_A4,4, NOTE_A4,4,
 +
  REST,8, NOTE_E4,8, NOTE_B4,2,
 +
  NOTE_F4,4, NOTE_C5,4, NOTE_C5,4,
 +
  REST,8, NOTE_E4,8, NOTE_B4,2,
 +
  NOTE_D4,4, NOTE_A4,4, NOTE_A4,4,
 +
  REST,8, NOTE_E4,8, NOTE_B4,2,
 +
  NOTE_F4,4, NOTE_C5,4, NOTE_C5,4,
 +
  REST,8, NOTE_E4,8, NOTE_B4,2,
 +
  NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
 +
 
 +
  NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
 +
  NOTE_E5,-4, NOTE_F5,8, NOTE_E5,8, NOTE_E5,8,
 +
  NOTE_E5,8, NOTE_C5,8, NOTE_A4,2,
 +
  NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
 +
  NOTE_A4,-2,
 +
  NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
 +
  NOTE_E4,-2,
 +
  NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
 +
  NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
 +
 
 +
  NOTE_E5,-4, NOTE_F5,8, NOTE_E5,8, NOTE_E5,8,
 +
  NOTE_E5,8, NOTE_C5,8, NOTE_A4,2,
 +
  NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
 +
  NOTE_A4,2, NOTE_A4,4,
 +
  NOTE_D4,1,
 +
};
 +
 
 +
// sizeof gives the number of bytes, each int value is composed of two bytes (16 bits)
 +
// there are two values per note (pitch and duration), so for each note there are four bytes
 +
int notes = sizeof(melody) / sizeof(melody[0]) / 2;
 +
 
 +
// this calculates the duration of a whole note in ms
 +
int wholenote = (60000 * 4) / tempo;
 +
 
 +
int divider = 0, noteDuration = 0;
 +
 
 +
 
 +
 
 +
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(16, 16, PIN,
 +
                            NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
 +
                            NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
 +
                            NEO_GRB  + NEO_KHZ800);
 +
                           
 +
const uint16_t colors[] = { matrix.Color(255, 184, 28), matrix.Color(0, 219, 73), matrix.Color(255, 41, 60), matrix.Color(24, 12, 255), matrix.Color(50, 50, 50) };
 +
 
 +
int score = 0;
 +
int pass = 0;
 +
int iterator = 0;
 +
int currentState = LOW;
 +
 
 +
void setup() {
 +
  // put your setup code here, to run once:
 +
  matrix.begin();
 +
  matrix.setTextWrap(false);
 +
  matrix.setBrightness(40);
 +
  matrix.setTextColor(colors[0]);
 +
 
 +
  pinMode(BTN_X, INPUT_PULLUP);
 +
  pinMode(BTN_Y, INPUT_PULLUP);
 +
  pinMode(BTN_Z, INPUT_PULLUP);
 +
  pinMode(BTN_W, INPUT_PULLUP);
 +
}
 +
 
 +
bool play_note(int offset, int color, int thisNote) {
 +
  bool note_played = false;
 +
  int x=matrix.width();
 +
  int t_start=millis();
 +
  int t_loop=millis();
 +
 
 +
  divider = melody[thisNote + 1];
 +
  if (divider > 0) {
 +
    // regular note, just proceed
 +
    noteDuration = (wholenote) / divider;
 +
  } else if (divider < 0) {
 +
    // dotted notes are represented with negative durations!!
 +
    noteDuration = (wholenote) / abs(divider);
 +
    noteDuration *= 1.5; // increases the duration in half for dotted notes
 +
  }
 +
 
 +
  while (x>1) {
 +
    x=x-1;
 +
    matrix.begin();
 +
    matrix.drawLine(x, 1+offset, x-1, 1+offset, colors[color]);
 +
    matrix.drawLine(x, 2+offset, x-1, 2+offset, colors[color]);
 +
    matrix.drawLine(x+1, 1+offset, x+1, 2+offset, matrix.Color(0, 0, 0));
 +
    matrix.show();
 +
    while (1) {
 +
      t_loop=millis();
 +
 
 +
      if (x<10) {
 +
        /* IMPLEMENT BUTTON CHECK */
 +
        /* PLAY NOTE SOUND HERE ? */
 +
 
 +
        currentState=HIGH;
 +
        if (color==0) {currentState = digitalRead(BTN_X);}
 +
        else if (color==1) {currentState = digitalRead(BTN_Y);}
 +
        else if (color==2) {currentState = digitalRead(BTN_Z);}
 +
        else if (color==3) {currentState = digitalRead(BTN_W);}
 +
       
 +
        if (currentState!=HIGH) {
 +
          note_played=true;
 +
        }
 +
        if (note_played==true) {
 +
          tone(buzzer, melody[thisNote], noteDuration * 0.9);
 +
        }
 +
       
 +
      }
 +
     
 +
      if (t_loop>t_start+15) {
 +
        t_start=millis();
 +
        noTone(buzzer);
 +
        break;
 +
      }
 +
    }
 +
  }
 +
  return note_played;
 +
}
 +
 
 +
void loop() {
 +
  if (play_note(4*music[iterator], music[iterator], iterator*2)==true) {score+=1;}
 +
  else {/* DO SOMETHING IF MISSED NOTE */}
 +
 
 +
  ++iterator; if (iterator>(int)(sizeof(melody)/2)) {iterator=0;}
 +
 
 +
  //delay(100);
 +
}
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Version du 31 janvier 2024 à 17:00

Titre de la fiche expérience :

Description (résumé)

Notre équipe a décidé pour se Hackathon de créer un jeu de rythme inspiré de la série de jeux vidéos "Guitar Hero" qui consiste à appuyer sur des boutons en fonction du rythme de la musique et des indications à l'écran. Nous l'avons nommé "Bass Hero"

BassHero.png

Pour ce faire des carrés lumineux descendront sur un écran LED 16x16 et indiqueront au joueur à quels moments appuyer sur les boutons correspondant

Introduction

Nous sommes 5 à participer à ce projet:

Yassine, Olivier, Antoine, Yann, Rodrigue

Yassine.jpg Olivier Riviere.jpg Antoine Vermander.PNG Yann Tissier.jpg Rodrigue Lemaire.jpg

Le projet que nous avons choisis n'avait pas de thème précis donc nous avons pu laisser libre cours à notre imagination, et nous avons donc eu l'idée de faire un jeu de rythme simple pour pouvoir utiliser complétement la grille de LED 16x16 qui nous a été donné

Outil et matériel

- Carte Arduino Nano

- 4 Boutons

- Buzzer Piézo-électrique

- Câbles

- BreadBoard

- Écran LCD

- Écran LED 16x16

- Boite en carton

Fichiers joint

Code Arduino

  1  
  2 
  3 #include <Adafruit_GFX.h>
  4 #include <Adafruit_NeoMatrix.h>
  5 #include <Adafruit_NeoPixel.h>
  6 
  7 #define NOTE_B0  31
  8 #define NOTE_C1  33
  9 #define NOTE_CS1 35
 10 #define NOTE_D1  37
 11 #define NOTE_DS1 39
 12 #define NOTE_E1  41
 13 #define NOTE_F1  44
 14 #define NOTE_FS1 46
 15 #define NOTE_G1  49
 16 #define NOTE_GS1 52
 17 #define NOTE_A1  55
 18 #define NOTE_AS1 58
 19 #define NOTE_B1  62
 20 #define NOTE_C2  65
 21 #define NOTE_CS2 69
 22 #define NOTE_D2  73
 23 #define NOTE_DS2 78
 24 #define NOTE_E2  82
 25 #define NOTE_F2  87
 26 #define NOTE_FS2 93
 27 #define NOTE_G2  98
 28 #define NOTE_GS2 104
 29 #define NOTE_A2  110
 30 #define NOTE_AS2 117
 31 #define NOTE_B2  123
 32 #define NOTE_C3  131
 33 #define NOTE_CS3 139
 34 #define NOTE_D3  147
 35 #define NOTE_DS3 156
 36 #define NOTE_E3  165
 37 #define NOTE_F3  175
 38 #define NOTE_FS3 185
 39 #define NOTE_G3  196
 40 #define NOTE_GS3 208
 41 #define NOTE_A3  220
 42 #define NOTE_AS3 233
 43 #define NOTE_B3  247
 44 #define NOTE_C4  262
 45 #define NOTE_CS4 277
 46 #define NOTE_D4  294
 47 #define NOTE_DS4 311
 48 #define NOTE_E4  330
 49 #define NOTE_F4  349
 50 #define NOTE_FS4 370
 51 #define NOTE_G4  392
 52 #define NOTE_GS4 415
 53 #define NOTE_A4  440
 54 #define NOTE_AS4 466
 55 #define NOTE_B4  494
 56 #define NOTE_C5  523
 57 #define NOTE_CS5 554
 58 #define NOTE_D5  587
 59 #define NOTE_DS5 622
 60 #define NOTE_E5  659
 61 #define NOTE_F5  698
 62 #define NOTE_FS5 740
 63 #define NOTE_G5  784
 64 #define NOTE_GS5 831
 65 #define NOTE_A5  880
 66 #define NOTE_AS5 932
 67 #define NOTE_B5  988
 68 #define NOTE_C6  1047
 69 #define NOTE_CS6 1109
 70 #define NOTE_D6  1175
 71 #define NOTE_DS6 1245
 72 #define NOTE_E6  1319
 73 #define NOTE_F6  1397
 74 #define NOTE_FS6 1480
 75 #define NOTE_G6  1568
 76 #define NOTE_GS6 1661
 77 #define NOTE_A6  1760
 78 #define NOTE_AS6 1865
 79 #define NOTE_B6  1976
 80 #define NOTE_C7  2093
 81 #define NOTE_CS7 2217
 82 #define NOTE_D7  2349
 83 #define NOTE_DS7 2489
 84 #define NOTE_E7  2637
 85 #define NOTE_F7  2794
 86 #define NOTE_FS7 2960
 87 #define NOTE_G7  3136
 88 #define NOTE_GS7 3322
 89 #define NOTE_A7  3520
 90 #define NOTE_AS7 3729
 91 #define NOTE_B7  3951
 92 #define NOTE_C8  4186
 93 #define NOTE_CS8 4435
 94 #define NOTE_D8  4699
 95 #define NOTE_DS8 4978
 96 #define REST      0
 97 
 98 #define PIN 8
 99 #define BTN_X 2
100 #define BTN_Y 3
101 #define BTN_Z 4
102 #define BTN_W 5
103 #ifndef PSTR
104  #define PSTR // Make Arduino Due happy
105 #endif
106 
107 // change this to whichever pin you want to use
108 int buzzer = 11;
109 
110 int music[] = {1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,
111               0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,
112               0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,
113               0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,2,3,1,1,0,2,1,3,1,0,3,0,0,2,3,1,1,};
114 int tempo = 100;
115 //int wholenote = (60000 * 4) / tempo;
116 
117 // notes of the moledy followed by the duration.
118 // a 4 means a quarter note, 8 an eighteenth , 16 sixteenth, so on
119 // !!negative numbers are used to represent dotted notes,
120 // so -4 means a dotted quarter note, that is, a quarter plus an eighteenth!!
121 /*int melody[] = {
122 
123   // Nokia Ringtone 
124   // Score available at https://musescore.com/user/29944637/scores/5266155
125   
126   NOTE_E5, 8, NOTE_D5, 8, NOTE_FS4, 4, NOTE_GS4, 4, 
127   NOTE_CS5, 8, NOTE_B4, 8, NOTE_D4, 4, NOTE_E4, 4, 
128   NOTE_B4, 8, NOTE_A4, 8, NOTE_CS4, 4, NOTE_E4, 4,
129   NOTE_A4, 2, 
130 };*/
131 int melody[] = {
132   
133   // Song of storms - The Legend of Zelda Ocarina of Time. 
134   // Score available at https://musescore.com/user/4957541/scores/1545401
135   
136   NOTE_D4,4, NOTE_A4,4, NOTE_A4,4,
137   REST,8, NOTE_E4,8, NOTE_B4,2,
138   NOTE_F4,4, NOTE_C5,4, NOTE_C5,4,
139   REST,8, NOTE_E4,8, NOTE_B4,2,
140   NOTE_D4,4, NOTE_A4,4, NOTE_A4,4,
141   REST,8, NOTE_E4,8, NOTE_B4,2,
142   NOTE_F4,4, NOTE_C5,4, NOTE_C5,4,
143   REST,8, NOTE_E4,8, NOTE_B4,2,
144   NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
145   
146   NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
147   NOTE_E5,-4, NOTE_F5,8, NOTE_E5,8, NOTE_E5,8,
148   NOTE_E5,8, NOTE_C5,8, NOTE_A4,2,
149   NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
150   NOTE_A4,-2,
151   NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
152   NOTE_E4,-2,
153   NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
154   NOTE_D4,8, NOTE_F4,8, NOTE_D5,2,
155 
156   NOTE_E5,-4, NOTE_F5,8, NOTE_E5,8, NOTE_E5,8,
157   NOTE_E5,8, NOTE_C5,8, NOTE_A4,2,
158   NOTE_A4,4, NOTE_D4,4, NOTE_F4,8, NOTE_G4,8,
159   NOTE_A4,2, NOTE_A4,4,
160   NOTE_D4,1,
161 };
162 
163 // sizeof gives the number of bytes, each int value is composed of two bytes (16 bits)
164 // there are two values per note (pitch and duration), so for each note there are four bytes
165 int notes = sizeof(melody) / sizeof(melody[0]) / 2;
166 
167 // this calculates the duration of a whole note in ms
168 int wholenote = (60000 * 4) / tempo;
169 
170 int divider = 0, noteDuration = 0;
171 
172 
173 
174 Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(16, 16, PIN,
175                             NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
176                             NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
177                             NEO_GRB  + NEO_KHZ800);
178                             
179 const uint16_t colors[] = { matrix.Color(255, 184, 28), matrix.Color(0, 219, 73), matrix.Color(255, 41, 60), matrix.Color(24, 12, 255), matrix.Color(50, 50, 50) };
180 
181 int score = 0;
182 int pass = 0;
183 int iterator = 0;
184 int currentState = LOW;
185 
186 void setup() {
187   // put your setup code here, to run once:
188   matrix.begin();
189   matrix.setTextWrap(false);
190   matrix.setBrightness(40);
191   matrix.setTextColor(colors[0]);
192 
193   pinMode(BTN_X, INPUT_PULLUP);
194   pinMode(BTN_Y, INPUT_PULLUP);
195   pinMode(BTN_Z, INPUT_PULLUP);
196   pinMode(BTN_W, INPUT_PULLUP);
197 }
198 
199 bool play_note(int offset, int color, int thisNote) {
200   bool note_played = false;
201   int x=matrix.width();
202   int t_start=millis();
203   int t_loop=millis();
204 
205   divider = melody[thisNote + 1];
206   if (divider > 0) {
207     // regular note, just proceed
208     noteDuration = (wholenote) / divider;
209   } else if (divider < 0) {
210     // dotted notes are represented with negative durations!!
211     noteDuration = (wholenote) / abs(divider);
212     noteDuration *= 1.5; // increases the duration in half for dotted notes
213   }
214   
215   while (x>1) {
216     x=x-1;
217     matrix.begin();
218     matrix.drawLine(x, 1+offset, x-1, 1+offset, colors[color]);
219     matrix.drawLine(x, 2+offset, x-1, 2+offset, colors[color]);
220     matrix.drawLine(x+1, 1+offset, x+1, 2+offset, matrix.Color(0, 0, 0));
221     matrix.show();
222     while (1) {
223       t_loop=millis();
224 
225       if (x<10) {
226         /* IMPLEMENT BUTTON CHECK */
227         /* PLAY NOTE SOUND HERE ? */
228 
229         currentState=HIGH;
230         if (color==0) {currentState = digitalRead(BTN_X);}
231         else if (color==1) {currentState = digitalRead(BTN_Y);}
232         else if (color==2) {currentState = digitalRead(BTN_Z);}
233         else if (color==3) {currentState = digitalRead(BTN_W);}
234         
235         if (currentState!=HIGH) {
236           note_played=true;
237         }
238         if (note_played==true) {
239           tone(buzzer, melody[thisNote], noteDuration * 0.9);
240         }
241         
242       }
243       
244       if (t_loop>t_start+15) {
245         t_start=millis();
246         noTone(buzzer);
247         break;
248       }
249     }
250   }
251   return note_played;
252 }
253 
254 void loop() {
255   if (play_note(4*music[iterator], music[iterator], iterator*2)==true) {score+=1;}
256   else {/* DO SOMETHING IF MISSED NOTE */}
257 
258   ++iterator; if (iterator>(int)(sizeof(melody)/2)) {iterator=0;}
259   
260   //delay(100);
261 }

Étapes de fabrication

Voici les différentes étapes que nous avons utilisé pour arriver au projet final:

Circuit Bass Hero.png

Étape 1

Pour commencer on a fabriqué un prototype de la boite en partant d'un carton vide, qui contiendra les circuits internes pour avoir une idée de à quoi ressemblera le projet final:

Carton vide Bass Hero.jpg Prototype 1 Bass Hero.jpg

Étape 2

Début de la création du code (connexions à la carte, affichage des lumières):

Codage du debut Bass Hero.jpg

Étape 3

Préparation des circuits électroniques:

Electronique Bass Hero.jpg Connexions Electronique Bass Hero.jpg

Étape 4

Préparation de la boite du produit final:

Préparation boite final Bass Hero.jpg

Étape 5

Finalisation du code et préparation des interactions avec le joueur:

Finialisation Bass Hero.gif

Étape 6

Installation des composants:

Installation Bass Hero.jpg

Étape 7

Projet Terminé:

Fin de projet Bass Hero.jpg

Difficultés rencontrés

Le plus gros problème qui nous a été posé été la presque impossibilité de se connecter à la carte ESP32 et à la carte Arduino qui avait été utilisé pour replacer la carte ESP32 à cause de ce problème. Cette difficulté est celle qui nous a fait perdre la grande majorité de notre temps et qui a dû être compenser par la programmation du jeu en dehors des heures allouées. Nous n'avons pas vraiment réglé ce souci mais nous avons dû faire avec.

Nous n'avons pas pu utiliser la boite du prototype car nous n'avons pas eu le temps de découper les planches de bois bien que les plans soient prêt à être utilisés et des composants été cassés

Nous avons aussi dû abandonner l'idée d'utiliser des haut parleurs pour la musique et le remplacer par un buzzer piézo-électrique de plus l'installation du lecteur LCD n'a pas pu être faites par manque de temps

Projet Complémentaire Bass Hero +

En vue de la possibilité de non réussite du projet Bass Hero, nous avons pu faire en une dizaine de minutes et en nous basant sur les connaissances acquises pendant ce Hackaton, un autre jeu pour pouvoir présenter quelque chose aux enfants.

Ce jeu ce base sur le très célèbre "Dinosaur game" qui apparait quand un utilisateur du navigateur Google n'a pas de connexion.

Bass Hero + ce joue en appuyant sur le bouton central pour pouvoir esquiver les obstacles barrant la route du joueur.

Bass Hero plus.jpg

ne pas modifier sous cette ligne