Memory Game

        The previous research I did for my group project didn’t significantly impact my midterm project as it wasn’t really software based.  I would say that the research I did while planning for my group project did have some effects on my midterm project, as it showcased different forms of interactivity with users. An example of this is the Mind the “Uuh” a product meant to help the user improve their speech patterns by letting them know how many times and when a user says uhhh. The thing from this project that triggered my understanding of interaction is the fact that the product and user interact with each other. The user must do something in order for the product to react or do something back. From this product and the readings earlier in this course, interactivity is between the user and the product. The user must do something(input) in order for the product to reach the final result(output). My project was based on one concept, games. When narrowing this down I choose to go down the memory game route as I believe it is the most compatible option with sensors. I added my own twist to the concept of memory games by combining the concept of Simon Says and bop it. Simon Says is a game where a person tells a person to do something with the phrasing “Simon says…” and they have to do it otherwise they will lose. Bop it! is a handheld game where the user or users hold the machine and have to physically do the motion on the machine they are told to do otherwise they lose. As it can be seen both of these games have the concept of one having to do an action they are told otherwise they lose. I took this concept and added the element of memory to it. I did this by creating a game where there are 8 buttons and the first user has to touch the buttons 8 times in any order they want, while it plays a certain melody for aesthetics. The second user would then have to memorize the order and try to recreate the concept of Simon Says but with memorization and the physical aspects of Bop it! My own twist is added as they would have to do the 8 moves in one go. My project is intended for people who enjoy games, the target demographic being people aged 13-22 as they are people who would be interested in more physically demanding games.

 

 

        My understanding of how users were going to interact with my project informed certain design decisions I made such as changing my concept design from one to wear on your body to one on a “board” as seen below.

I had originally used tape to put the buttons on parts of the person’s body, so then they could touch either their head, right shoulder, left shoulder, right arm, left arm, stomach, right leg, or left leg. We were going to make a one-size shirt in order to make the putting-on process easier but after showcasing my project the first time I got told the wiring was hard to look at and that it would be better in a different format. So based on that, I decided to make it on a stable board where the wiring could be contained together, so that my project would be easy to the eye and the wires wouldn’t be a mess, as an issue with my project was the wires coming out of the Arduino as it wasn’t stabilized at first. The board was made with a carton, hot glue, and paint/marker. For the buttons themselves, we used cardboard, copper tape, hot glue, and wires to connect them to the Arduino. These items were the most suitable since they were the strongest, most stable and copper tape conducts electricity. Other options such as paper or liquid glue would have been too weak.

 

 

        I mostly worked on the code and built the entire circuit. I learned how to code the buttons from 

/**

* Button

* This was adapted from a the tutorial found here:

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button

*/

My partner did the physical components(like the buttons and board) and helped finalize the code as I wasn’t able to figure it out. Our process of making our project was working in the lab at the same time on our own parts and at points individually working on it once at a time. My partner did not attend the User Testing Session so it was difficult demonstrating the product, since I wasn’t able to discuss ideas with them. During the User Testing Session, I was told to make the game into levels, make visually obvious what the project is, and get rid of wires. Based on this when making the board the wires were adjusted nicely as seen below and we named our project so people would know it was a game. There will also be a sketch that inspired this model except that we transferred it from an Arduino to a board as our buttons are quite big and we needed the paddle to touch the button to work instead of the user’s fingers. 

The level concern wasn’t addressed as we weren’t able to figure out how to make it into levels. I do think these new adaptations were effective as people could now tell what the project was and now it wasn’t messy to look at. During the User Testing Session, I had some difficulties with the code as it would only record the movement of the first person but wouldn’t play any sounds and would end directly after the first person ended. I was able to quickly modify the code once I realized this and it was able to play the sounds of when user one would tap and record the movements. I did this by removing the conditions for noTone as seen below, the commented-out lines are what I removed. 

} else {

       noTone(13);

      // if (i = buttonNum){

       //if (i = 8) {

         //Serial.print(“You are done!”);

      // }

     }  //print  you are done

The code overall was quite hard to work on, it took a lot of adapting and adjusting. Originally I was supposed to make a code where there would be two different sets one person would use the first set then the second person would use the second set. The purpose of this was to make the user more convenient and comfortable playing with each other. I wasn’t able to get it to do that so we just made the code work for one set that would compare the movements of the first person and then the second person. I do think these changes to the code and code structure(one set vs two) were justified as it made the code work for what we wanted. 

 

 

        The goal of our project was to make a game where one person pressed a random order of 8 buttons and the second person would imitate it and if they did it correctly the second person would win. If the second person did it incorrectly the first person would win. My project results did align with my definition of interaction as not only did my project record every move but it also made a sound letting the user know the movement was recorded. So this shows how the product responds to the user’s actions. In order for the product to do something the user has to do something to it. My audience interacted with my object by pressing the buttons with the paddle. I would improve my project if I had more time by writing clear instructions on the board. I would also install two separate LEDS, one that is next to player 1 sign and another next to player 2 sign, in the scenario that one would light up when the user wins. I would also add a 3rd LED next to a done sign that would light up after player 1 would finish so that player 2 would know to start, as feedback from the professor was to transfer the serial messages to the board to make the product itself more interactive. One final fix I would do is to make it so that my project wouldn’t be sensitive to faux double tapping by adjusting the code. I learned that clear instructions and signs should be on one’s product for the user to be immersed in it and know what to do. I will keep this in mind when making new products. A positive thing I take back from this project is learning how to use Arduino code in a more extensive way. Also, I learned more about buttons and how circuits work in depth as I had been having trouble with that. I now understand how electricity conducts by Arduinos. 

 

Full Material List:

Cardboard

Hot Glue

Arduino Uno

Breadboard

220k ohm resistors

Buzzer

Jumper Cables(M/M wires)

Copper Tape

Markers

Paint

Wires

Wire cutters

 

Below is the circuit:

 

Below is the full code:

/*

 DigitalReadSerial

 Reads a digital input on pin 2, prints the result to the Serial Monitor

 This example code is in the public domain.

 https://www.arduino.cc/en/Tutorial/BuiltInExamples/DigitalReadSerial

*/

// digital pin 2 has a pushbutton attached to it. Give it a name:

// int SequenceV;

// char SeqArr[10] = “”;

//1. complete l

//2. make the second the total

//3. save player 2 > second total

//4. compare total w total 2

//5. save results

//6. lose / win

//second total for second player

// for loop checking both totals

//for

// for (i < buttonNum)

//total[i] == total2[i]

//save that is the same(save result)

//check how many out of ten they get right

const int buttonNum = 8; //first one 3, 5,7(make levels) timeout new input within certain time , get rid of wires, make it visually obvious what it does, make it recor

int total[buttonNum];

int total2[buttonNum];

int counter = 0;

int leftShoulder = 2;

int rightShoulder = 3;

int leftLeg = 4;

int rightLeg = 5;

int leftArm = 6;

int rightArm = 7;

int head = 8;

int stomach = 9;

int button0;

int button1;

int button2;

int button3;

int button4;

int button5;

int button6;

int button7;

int Pbutton0;

int Pbutton1;

int Pbutton2;

int Pbutton3;

int Pbutton4;

int Pbutton5;

int Pbutton6;

int Pbutton7;

// the setup routine runs once when you press reset:

void setup() {

 // initialize serial communication at 9600 bits per second:

 Serial.begin(9600);

 Serial.println(“start”);

 // make the pushbutton’s pin an input:

 pinMode(leftShoulder, INPUT);

 pinMode(rightShoulder, INPUT);

 pinMode(leftLeg, INPUT);

 pinMode(rightLeg, INPUT);

 pinMode(leftArm, INPUT);

 pinMode(rightArm, INPUT);

 pinMode(head, INPUT);

 pinMode(stomach, INPUT);

 for (int i = 0; i < buttonNum; ++i) {

   total[i] = 0;

   total2[i]= 0;

 }

}

// the loop routine runs over and over again forever:

void loop() {

 while (counter < buttonNum) {

   //Serial.println(counter);

     // left shoulder button

 button0 = digitalRead(leftShoulder);

 //delay(1);  // delay in between reads for stability

 // right shoulder button

 button1 = digitalRead(rightShoulder);

 //Serial.println(button1);

 //delay(1);

 // left leg button

 button2 = digitalRead(leftLeg);

 //Serial.println(button2);

 //delay(1);

 // right leg button

 button3 = digitalRead(rightLeg);

 //Serial.println(button3);

 //delay(1);  // delay in between reads for stability

 // left arm button

 button4 = digitalRead(leftArm);

 //Serial.println(button4);

 //delay(1);

 // right arm button

 button5 = digitalRead(rightArm);

 //Serial.println(button5);

 //delay(1);

 // head button

 button6 = digitalRead(head);

 //Serial.println(button6);

 //delay(1);

 // stomach button

 button7 = digitalRead(stomach);

 //Serial.println(button7);

 //delay(1);

     if (button0 == 1) {  // left shoulder

       tone(13, 261);

       if (button0 != Pbutton0) {

         total[counter] = 1;

         counter++;

         delay(50);

         //total2[counter] = 1;

         //counter++;

       }

     } else if (button1 == 1) {  // right shoulder

       tone(13, 294);

       if (button1 != Pbutton1) {

         total[counter] = 2;

         counter++;

         delay(50);

         //total2[counter] = 2;

         //counter++;

       }

     } else if (button2 == 1) {  // left leg

       tone(13, 311);

       if (button2 != Pbutton2) {

         total[counter] = 3;

         counter++;

         delay(50);

         //total2[counter] = 3;

         //counter++;

       }

     } else if (button3 == 1) {  // right leg

       tone(13, 311);

       if (button3 != Pbutton3) {

         total[counter] = 4;

         counter++;

         delay(50);

         //total2[counter] = 4;

         //counter++;

       }

     } else if (button4 == 1) {  // left arm

       tone(13, 311);

       if (button4 != Pbutton4) {

         total[counter] = 5;

         counter++;

         delay(50);

         //total2[counter] = 5;

         //counter++;

       }

     } else if (button5 == 1) {  // right arm

       tone(13, 311);

       if (button5 != Pbutton5) {

         total[counter] = 6;

         counter++;

         delay(50);

         //total2[counter] = 6;

         //counter++;

       }

     } else if (button6 == 1) {  // head

       tone(13, 311);

       if (button6 != Pbutton6) {

         total[counter] = 7;

         counter++;

         delay(50);

         //total2[counter] = 7;

         //counter++;

       }

     } else if (button7 == 1) {  // stomach

       tone(13, 311);

       if (button7 != Pbutton7) {

         total[counter] = 8;

         counter++;

         delay(50);

         //total2[counter] = 8;

         //counter++;

       }

     } else {

       noTone(13);

      // if (i = buttonNum){

       //if (i = 8) {

         //Serial.print(“You are done!”);

      // }

     }  //print  you are done

     Pbutton0 = button0;

     Pbutton1 = button1;

     Pbutton2 = button2;

     Pbutton3 = button3;

     Pbutton4 = button4;

     Pbutton5 = button5;

     Pbutton6 = button6;

     Pbutton7 = button7;

   }

     noTone(13);

    

       //if (i = 8) {

   Serial.println(“P1 DONE!”);

   //for (int i = 0; i<8; i++) {

     //Serial.print(total[i]);

     //Serial.print(“,”);

   //}

   counter = 0;

   delay(1000);

   while (counter < buttonNum) {

   //Serial.println(counter);

     // left shoulder button

 button0 = digitalRead(leftShoulder);

 //delay(1);  // delay in between reads for stability

 // right shoulder button

 button1 = digitalRead(rightShoulder);

 //Serial.println(button1);

 //delay(1);

 // left leg button

 button2 = digitalRead(leftLeg);

 //Serial.println(button2);

 //delay(1);

 // right leg button

 button3 = digitalRead(rightLeg);

 //Serial.println(button3);

 //delay(1);  // delay in between reads for stability

 // left arm button

 button4 = digitalRead(leftArm);

 //Serial.println(button4);

 //delay(1);

 // right arm button

 button5 = digitalRead(rightArm);

 //Serial.println(button5);

 //delay(1);

 // head button

 button6 = digitalRead(head);

 //Serial.println(button6);

 //delay(1);

 // stomach button

 button7 = digitalRead(stomach);

 //Serial.println(button7);

 //delay(1);

     if (button0 == 1) {  // left shoulder

       tone(13, 261);

       if (button0 != Pbutton0) {

         total2[counter] = 1;

         counter++;

         delay(50);

         //total2[counter] = 1;

         //counter++;

       }

     } else if (button1 == 1) {  // right shoulder

       tone(13, 294);

       if (button1 != Pbutton1) {

         total2[counter] = 2;

         counter++;

         delay(50);

         //total2[counter] = 2;

         //counter++;

       }

     } else if (button2 == 1) {  // left leg

       tone(13, 311);

       if (button2 != Pbutton2) {

         total2[counter] = 3;

         counter++;

         delay(50);

         //total2[counter] = 3;

         //counter++;

       }

     } else if (button3 == 1) {  // right leg

       tone(13, 311);

       if (button3 != Pbutton3) {

         total2[counter] = 4;

         counter++;

         delay(50);

         //total2[counter] = 4;

         //counter++;

       }

     } else if (button4 == 1) {  // left arm

       tone(13, 311);

       if (button4 != Pbutton4) {

         total2[counter] = 5;

         counter++;

         delay(50);

         //total2[counter] = 5;

         //counter++;

       }

     } else if (button5 == 1) {  // right arm

       tone(13, 311);

       if (button5 != Pbutton5) {

         total2[counter] = 6;

         counter++;

         delay(50);

         //total2[counter] = 6;

         //counter++;

       }

     } else if (button6 == 1) {  // head

       tone(13, 311);

       if (button6 != Pbutton6) {

         total2[counter] = 7;

         counter++;

         delay(50);

         //total2[counter] = 7;

         //counter++;

       }

     } else if (button7 == 1) {  // stomach

       tone(13, 311);

       if (button7 != Pbutton7) {

         total2[counter] = 8;

         counter++;

         delay(50);

         //total2[counter] = 8;

         //counter++;

       }

     } else {

       noTone(13);

      // if (i = buttonNum){

       //if (i = 8) {

         //Serial.print(“You are done!”);

      // }

     }  //print  you are done

     Pbutton0 = button0;

     Pbutton1 = button1;

     Pbutton2 = button2;

     Pbutton3 = button3;

     Pbutton4 = button4;

     Pbutton5 = button5;

     Pbutton6 = button6;

     Pbutton7 = button7;

   }

     noTone(13);

    

       //if (i = 8) {

   Serial.println(“P2 DONE!”);

   for (int i = 0; i<8; i++) {

     Serial.print(total[i]);

     Serial.print(“,”);

   }

   Serial.println();

   for (int i = 0; i<8; i++) {

     Serial.print(total2[i]);

     Serial.print(“,”);

   }

   delay(1000);

   bool p1Win = false;

   for (int i = 0; i<buttonNum; ++i) {

     if (total[i] != total2[i]) {

       Serial.println(“PLAYER 1 WINS”);

       p1Win = true;

       break;

     }

   }

   if (!p1Win) {

     Serial.println(“PLAYER 2 WINS”);

   }

   delay(50000);

     //if (counter > buttonNum && counter < buttonNum * 2) {  //save p2

       //counter = 0;

     //}

   //compare outside

 /*int oneElementSize = sizeof(total[0]);

 if (sizeof(total2[0] == oneElementSize) {        // Are the sizes of the elements the same?

   if (sizeof(total2) == sizeof(total)) {   // Are the number of elements the same?

       if (memcmp(total2, total, sizeof(total2) * oneElementSize) == 0)

     Serial.println(“Player 2 Won!!!!”);

     delay(1000);

           // do this if they are equal

       }else{

         Serial.println(“Player 1 Won!!!!”);

         delay(1000);

           // do this if they are different

       }*/

      

 }

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *