Speed Press – Roman Moskvichev (Physical Computing)

 

 

 

 

 

Speed Press.

By Roman Moskvichev.

 

 

 

 

 

 

 

 

 

 

 

 

January 11, 2015

Description.

The Arduino device made is a minigame of ear to hand coordination, the players compete on who has the fastest reaction and who presses the button first. The game consists of seven rounds – whoever gets seven presses first wins. The game is created using 2 FSR (Force Sensor Resistors) 2 LEDs and one Buzzer. The round starts when buzzer makes a sound and then the players have a small timeframe to press the button, whoever presses first – gets one point. There are 2 players Red and Green, on each first press of the button the LED of responding color lights up, showing who was first.  The score later gets printed in the serial monitor which also tracks who was first to press the button.

Photos.

20150211_093000

20150211_093012

20150211_092857

20150211_092933

20150211_092920

 

Development notes.

 

 

Developing this seemingly simple game was not as easy as was anticipated, the decision to to solder the wires in order to reuse them later proven to be quite challenging because the contacts bound with mechanic tape were constantly coming off and causing trouble with testing.

Brainstorming.

20150211_093459

During the development process I came across a problem of making a buzzard make only one signal, as it is behaving it makes a sound of set frequency and then emitting sound without any command,  any attempts to cancel the remaining signal were unsuccessful. Some of the attempts taken are: placing noTone() function at various places in the code, setting a third value for the sound which is the duration it is supposed to be going, and setting the frequency to zero after emitting the sound, all of above to no success.

 

 

Circuit Diagram.

 

Midsketch_bb

Code.

 

int fsrAnalogPin1 = 1;

int fsrAnalogPin2 = 0;

int LEDpin1 = 11;

int LEDpin2 = 10;

int fsrReading1;

int LEDbrightness1;

int fsrReading2;

int LEDbrightness2;

int speakerPin = 12;

int loopcount = 0;

int starttime = 0;

int endtime = 0;

int REDscore = 0;

int GREENscore = 0;

 

void setup(void) {

Serial.begin(9600);

pinMode(LEDpin1, OUTPUT);

pinMode(LEDpin2, OUTPUT);

}

 

void loop(void) {

 

 

 

 

fsrReading1 = analogRead(fsrAnalogPin1);

fsrReading2 = analogRead(fsrAnalogPin2);

 

 

 

LEDbrightness1 = map(fsrReading1, 0, 1023, 0, 255);

LEDbrightness2 = map(fsrReading2, 0, 1023, 0, 255);

 

//tone(12, 261, 500);

starttime = millis();

endtime = starttime;                                      //part of the code was referenced from http://forum.arduino.cc/index.php?topic=45787.0

while ((endtime – starttime) <=2000)

{

tone(speakerPin, 261, 1000);

 

if (fsrReading1 >= 250)

{

Serial.print(“Red scored “);

 

analogWrite(LEDpin1, LEDbrightness1);

analogWrite(LEDpin2, LOW);

REDscore++;

Serial.println(REDscore);

//noTone(speakerPin);

break;

}

else if (fsrReading2 >=250)

{

analogWrite(LEDpin2, LEDbrightness2);

analogWrite(LEDpin1, LOW);

Serial.print(“Green scored “);

 

GREENscore++;

Serial.println(GREENscore);

//noTone(speakerPin);

break;

}

 

loopcount = loopcount+1;

endtime = millis();

}

 

while (REDscore >= 7 || GREENscore >=7)

{

if (REDscore >= 7)

{

Serial.println(“Red player won “);

break;

}

else if (GREENscore >= 7)

{

Serial.println(“Green player won “);

break;

}

}

//noTone(speakerPin);

delay(random(3000,6000));

 

}

Future development.

For further development project need to be improved in multiple ways: Firstly the code could be more optimized and shortened for the sake of simplicity and readability, so far there are a lot of variables floating around which makes reading confusing, Then the wires could be soldered even better if made rom one piece of wire in order to prevent misconnections. As for the brighter future – it could be enhanced with a better interface – using processing’s artis