-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtechnical_prototype.ino
84 lines (64 loc) · 2.62 KB
/
technical_prototype.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <SD.h> // need to include the SD library
#include <TMRpcm.h> //TMRpcm library for SD card courtesy https://github.com/TMRh20/TMRpcm
#include <SPI.h> //For standard protocol SPI communication with SD card reader, supports TCRpcm library
#include "pins_defined.h"
TMRpcm music; // create an object for use in this sketch
unsigned long time = 0;
/************************************ MAIN SETUP FUNCTION *****************************************************/
void setup() {
Serial.begin(9600); //Serial Communication begins at 9600 baud
pinMode(S0, OUTPUT); //TCS3200 Colour Sensor
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(outPut, INPUT);
digitalWrite(S0,HIGH); //Setting TCS3200 defaults
digitalWrite(S1,LOW);
music.speakerPin = 9; //speakerPIN replacement
pinMode(redLed, OUTPUT); //RGB LED
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);
pinMode(button, INPUT); //Main pushbutton
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
Serial.println("SD fail");
return; // don't do anything more if not
}
else{
Serial.println("SD ok");
}
//ledFlash(5); //Bootup feedback
//music.play("bootup"); //Make file "bootup"
}
/************************************ MAIN LOOP FUNCTION *****************************************************/
void loop() {
if(Serial.available()){
switch(Serial.read()){
case '1': mode1(); break;
case '2': mode2(); break;
case '3': mode3(); break;
case '4': mode4(); break;
}
}
/************************** case: mode 1 ************************************/
/*if (mode == 4) {
score = 0; //set score to zero
game_over = 0; //Game is not over
music.play("ready_ques");
delay(1000);
while(1) {
playMode();
if (game_over == 1) { //If boolean value is saved as 'game is over'
music.play(game_over); //Play game over sound
break;
}
}
}*/
/* colourCode = getColour();
printColour(colourCode);
Serial.print("\n");
printRGBvalues(rVal, gVal, bVal);
Serial.print("\n");
flashRGB(colourCode);
englishNames(colourCode);
delay(2000); */
}