TROP

From DigitalCraft_Wiki
Jump to navigation Jump to search
Trop game.jpg

TROP

TROP is a guessing game with the objective of understanding how circuits work in a fun musical way by recognizing any one of three different songs. Each TROP metaphorically represents an element in the circuit which creates and completes the song when stepped on.

TROP was a classroom project created by Aayushi Katare, Mridu Jhangiani and Shipra Balasubramani, as a part of the Digital Crafts, Extended Toolbox 2017.



How to Play

1.Choose one TROP from the first row and step on it to start playing. 2.Once you step on your first choice of TROP, a musical track begins to play. 3.Step on any one of the three TROPS of the following row, by guessing. By stepping on the right TROP, the succeeding musical note of the chosen path will be heard. 4.If you guess the wrong TROP, no song will play. 5.Each player gets three attempts to make an incorrect guess in the entirety of the game. 6.Each time a player makes an incorrect guess in a row, he/she loses an attempt but shall continue to play from the same point. 7.Guess the right TROP path to get to the finish line. On completing the path correctly, you would have created the correct musical sequence of the chosen path.


Trop logo.jpeg

Concept

Every TROP is a switch. When a player steps on a TROP, the switch closes, completing the circuit. On closing the circuit, current passes through the different components, resulting in the speaker playing a musical tone ( of different frequencies ).

5 TROPS = 5 elements in the closed circuit which create the musical track.

Row 1: Switch (a)

Row 2: Battery (b)

Row 3: Arduino (c)

Row 4: Wires (d)

Row 5: Speaker (e)


Process Gallery

{{#ev:youtube |93Caa1tfcfU }}

{{#ev:youtube |AMAvQx0djdc }}

Code

#define  C0 16.35
#define Db0 17.32
#define D0  18.35
#define Eb0 19.45
#define E0  20.60
#define F0  21.83
#define Gb0 23.12
#define G0  24.50
#define Ab0 25.96
#define LA0 27.50
#define Bb0 29.14
#define B0  30.87
#define C1  32.70
#define Db1 34.65
#define D1  36.71
#define Eb1 38.89
#define E1  41.20
#define F1  43.65
#define Gb1 46.25
#define G1  49.00
#define Ab1 51.91
#define LA1 55.00
#define Bb1 58.27
#define B1  61.74
#define C2  65.41
#define Db2 69.30
#define D2  73.42
#define Eb2 77.78
#define E2  82.41
#define F2  87.31
#define Gb2 92.50
#define G2  98.00
#define Ab2 103.83
#define LA2 110.00
#define Bb2 116.54
#define B2  123.47
#define C3  130.81
#define Db3 138.59
#define D3  146.83
#define Eb3 155.56
#define E3  164.81
#define F3  174.61
#define Gb3 185.00
#define G3  196.00
#define Ab3 207.65
#define LA3 220.00
#define Bb3 233.08
#define B3  246.94
#define C4  261.63
#define Db4 277.18
#define D4  293.66
#define Eb4 311.13
#define E4  329.63
#define F4  349.23
#define Gb4 369.99
#define G4  392.00
#define Ab4 415.30
#define LA4 440.00
#define Bb4 466.16
#define B4  493.88
#define C5  523.25
#define Db5 554.37
#define D5  587.33
#define Eb5 622.25
#define E5  659.26
#define F5  698.46
#define Gb5 739.99
#define G5  783.99
#define Ab5 830.61
#define LA5 880.00
#define Bb5 932.33
#define B5  987.77
#define C6  1046.50
#define Db6 1108.73
#define D6  1174.66
#define Eb6 1244.51
#define E6  1318.51
#define F6  1396.91
#define Gb6 1479.98
#define G6  1567.98
#define Ab6 1661.22
#define LA6 1760.00
#define Bb6 1864.66
#define B6  1975.53
#define C7  2093.00
#define Db7 2217.46
#define D7  2349.32
#define Eb7 2489.02
#define E7  2637.02
#define F7  2793.83
#define Gb7 2959.96
#define G7  3135.96
#define Ab7 3322.44
#define LA7 3520.01
#define Bb7 3729.31
#define B7  3951.07
#define C8  4186.01
#define Db8 4434.92
#define D8  4698.64
#define Eb8 4978.03
// DURATION OF THE NOTES 
#define BPM 120    //  you can change this value changing all the others
#define H 2*Q //half 2/4
#define Q 60000/BPM //quarter 1/4 
#define E Q/2   //eighth 1/8
#define S Q/4 // sixteenth 1/16
#define W 4*Q // whole 4/4


const int buttonPin1=1;
const int buttonPin2=2;
const int buttonPin3=3;
const int buttonPin4=4;
const int buttonPin5=5;
const int buttonPin6=6;
const int buttonPin7=7;
const int buttonPin8=8;
const int buttonPin9=9;
const int buttonPin10=10;
const int buttonPin11=11;
const int buttonPin12=12;
const int buttonPin13=14;
const int buttonPin14=15;
const int buttonPin15=16;


int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
int a9;
int a10;
int a11;
int a12;
int a13;
int a14;
int a15;

int buttonState1=0;
int buttonState2=0;
int buttonState3=0; 
int buttonState4=0;
int buttonState5=0;
int buttonState6=0;
int buttonState7=0;
int buttonState8=0;
int buttonState9=0; 
int buttonState10=0;
int buttonState11=0;
int buttonState12=0;
int buttonState13=0;
int buttonState14=0;
int buttonState15=0;

void setup() {
  // put your setup code here, to run once:
  
  pinMode (buttonPin1, INPUT_PULLUP);
  pinMode (buttonPin2, INPUT_PULLUP);
  pinMode (buttonPin3, INPUT_PULLUP);
  pinMode (buttonPin4, INPUT_PULLUP);
  pinMode (buttonPin5, INPUT_PULLUP);
  pinMode (buttonPin6, INPUT_PULLUP);
  pinMode (buttonPin7, INPUT_PULLUP);
  pinMode (buttonPin8, INPUT_PULLUP);
  pinMode (buttonPin9, INPUT_PULLUP);
  pinMode (buttonPin10, INPUT_PULLUP);
  pinMode (buttonPin11, INPUT_PULLUP);
  pinMode (buttonPin12, INPUT_PULLUP);
  pinMode (buttonPin13, INPUT_PULLUP);
  pinMode (buttonPin14, INPUT_PULLUP);
  pinMode (buttonPin15, INPUT_PULLUP); 
  pinMode(13,OUTPUT); 
}

void loop() {

   buttonState1 = digitalRead(buttonPin1);
   Serial.println(buttonState1);
  buttonState6 = digitalRead(buttonPin6);
   Serial.println(buttonState6);
  buttonState11 = digitalRead(buttonPin11);
   Serial.println(buttonState11);
   if (buttonState1 == LOW)
  {a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;a9=0;a10=0;a11=0;a12=0;a13=0;a14=0;a15=0;
   tone(13,LA3,Q); 
    delay(1+Q); //delay duration should always be 1 ms more than the note in order to separate them.
    tone(13,LA3,Q);
    delay(1+Q);
    tone(13,LA3,Q);
    delay(1+Q);
    tone(13,F3,E+S);
    delay(1+E+S);
    tone(13,C4,S);
    delay(1+S);a1=1;  }
  else if (buttonState6 == LOW)
  {a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;a9=0;a10=0;a11=0;a12=0;a13=0;a14=0;a15=0; 
tone(13,660,100);
delay(150);
tone(13,660,100);
delay(300);
tone(13,660,100);
delay(300);
tone(13,510,100);
delay(100);
tone(13,660,100);
delay(300);
tone(13,770,100);
delay(550);
tone(13,380,100);
delay(575); a6=1; }
  else if (buttonState11 == LOW)
  {a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;a9=0;a10=0;a11=0;a12=0;a13=0;a14=0;a15=0;
tone(13, 392, 1175);
delay(1200);
tone(13, 262, 1175);
delay(1200);
  a11=1;}
  else noTone(13);

  buttonState2 = digitalRead(buttonPin2);
   Serial.println(buttonState2);
  buttonState7 = digitalRead(buttonPin7);
   Serial.println(buttonState7);
  buttonState12 = digitalRead(buttonPin12);
   Serial.println(buttonState12);
  if (buttonState2 == LOW && a1==1)
  {    tone(13,LA3,Q);
    delay(1+Q);
    tone(13,F3,E+S);
    delay(1+E+S);
    tone(813,C4,S);
    delay(1+S);
    tone(13,LA3,H);
    delay(1+H); a2=1;
 } else noTone(13);
  
 if (buttonState7 == LOW && a6==1)
  {tone(13,510,100);
delay(450);
tone(13,380,100);
delay(400);
tone(13,320,100);
delay(500);
tone(13,440,100);
delay(300);
tone(13,480,80);
delay(330);
 a7=1;  }
 else noTone(13);
 if (buttonState12 == LOW && a11==1)
  {tone(13, 311, 175);
delay(200);
tone(13, 349, 175);
delay(200);
tone(13, 392, 775);
delay(800);
tone(13, 262, 775);
delay(800);
tone(13, 311, 175);
delay(200);
tone(13, 349, 175);
delay(300);
a12=1; }
  else noTone(13);


  buttonState3 = digitalRead(buttonPin3);
   Serial.println(buttonState3);
  buttonState8 = digitalRead(buttonPin8);
   Serial.println(buttonState8);
  buttonState13 = digitalRead(buttonPin13);
   Serial.println(buttonState13);
  if (buttonState3 == LOW && a2==1)
  {    tone(13,E4,Q); 
    delay(1+Q); 
    tone(13,E4,Q);
    delay(1+Q);
    tone(13,E4,Q);
    delay(1+Q);
    tone(13,F4,E+S);
    delay(1+E+S);
    tone(13,C4,S);
    delay(1+S);a3=1;
 } else noTone(13);
  
 if (buttonState8 == LOW && a7==1)
  {tone(13,450,100);
delay(150);
tone(13,430,100);
delay(300);
tone(13,380,100);
delay(200);
tone(13,660,80);
delay(200);
tone(13,760,50);
delay(150);
tone(13,860,100);
delay(300);
a8=1; }
 else noTone(13);
 if (buttonState13 == LOW && a12==1)
  {tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
a13=1;}
  else noTone(13);  

 
  buttonState4 = digitalRead(buttonPin4);
   Serial.println(buttonState4);
  buttonState9 = digitalRead(buttonPin9);
   Serial.println(buttonState9);
  buttonState14 = digitalRead(buttonPin14);
   Serial.println(buttonState14);
  if (buttonState4 == LOW && a3==1)
  {    tone(13,Ab3,Q);
    delay(1+Q);
    tone(13,F3,E+S);
    delay(1+E+S);
    tone(13,C4,S);
    delay(1+S);
    tone(13,LA3,H);
    delay(1+H);
    a4=1;
 } else noTone(13);
  
 if (buttonState9 == LOW && a8==1)
  {
tone(13,700,80);
delay(150);
tone(13,760,50);
delay(350);
tone(13,660,80);
delay(300);
tone(13,520,80);
delay(150);
tone(13,580,80);
delay(150);
tone(13,480,80);
delay(500);  a9=1; }
 else noTone(13);
 if (buttonState14 == LOW && a13==1)
  {tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
  a14=1; }
  else noTone(13);

  
  buttonState5 = digitalRead(buttonPin5);
   Serial.println(buttonState5);
  buttonState10 = digitalRead(buttonPin10);
   Serial.println(buttonState10);
  buttonState15 = digitalRead(buttonPin15);
   Serial.println(buttonState15);
  if (buttonState5 == LOW && a4==1)
  {    tone(13,LA4,Q);
    delay(1+Q);
    tone(13,LA3,E+S);
    delay(1+E+S);
    tone(13,LA3,S);
    delay(1+S);
    tone(13,LA4,Q);
    delay(1+Q);
    tone(13,Ab4,E+S);
    delay(1+E+S);
    tone(13,G4,S);
    delay(1+S);
     tone(13,Gb4,S);
    delay(1+S);
    tone(13,E4,S);
    delay(1+S);
    tone(13,F4,E);
    delay(1+E);
    delay(1+E);
    tone(13,Bb3,E);
    delay(1+E);
    tone(13,Eb4,Q);
    delay(1+Q);
    tone(13,D4,E+S);
    delay(1+E+S);
    tone(13,Db4,S);
    delay(1+S);
    tone(13,C4,S);
    delay(1+S);
    tone(13,B3,S);
    delay(1+S);
    tone(13,C4,E);
    delay(1+E);
    delay(1+E);
    tone(13,F3,E);
    delay(1+E);
    tone(13,Ab3,Q);
    delay(1+Q);
    tone(13,F3,E+S);
    delay(1+E+S);
    tone(13,LA3,S);
    delay(1+S);
  a5=1;
 } else noTone(13);
  
 if (buttonState10 == LOW && a9==1)
  {
tone(13,660,100);
delay(150);
tone(13,660,100);
delay(300);
tone(13,660,100);
delay(300);
tone(13,510,100);
delay(100);
tone(13,660,100);
delay(300);
tone(13,770,100);
delay(550);
tone(13,380,100);
delay(575);
a10=1; }
 else noTone(13);
 if (buttonState15 == LOW && a14==1)
  {
tone(13, 349, 1175);
delay(1200);
tone(13, 233, 1175);
delay(1200);
tone(13, 294, 175);
delay(200);
tone(13, 311, 175);
delay(200);
tone(13, 349, 775);
delay(800);
tone(13, 233, 775);
delay(800);
tone(13, 311, 175);
delay(200);
tone(13, 294, 175);
delay(200);
tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
tone(13, 131, 375);
delay(400);
tone(13, 156, 175);
delay(200);
tone(13, 175, 175);
delay(200);
tone(13, 196, 375);
delay(400);
  a15=1; }
  else noTone(13);

if (a15==1 || a5==1 || a10==1)
{ a1=0;a2=0;a3=0;a4=0;a5=0;a6=0;a7=0;a8=0;a9=0;a10=0;a11=0;a12=0;a13=0;a14=0;a15=0;}
else noTone(13);
}