Chopsticks Practice Game
by Dora Hsi in Workshop > Electric Vehicles
568 Views, 0 Favorites, 0 Comments
Chopsticks Practice Game
For elders hand rehabilitation, an interesting game would enhance effectiveness through interacting with both muscles and brain. According to Physiopedia, elders above the ages of fifty would have chances of suffering from deteriorating hand movement. Thus, by training the muscles and nerves of our hands, such symptoms could be ameliorated. Combining fun games with therapy could benefit the relationship between families and also improve physical health.
YouTube link: https://youtu.be/S2dYeGXSJZU
Downloads
Supplies
1. resistance*9
2. solderless breadboard*2
3. Arduino Leonardo*2
4. led light bulb (yellow*2 blue*1 red*1 green*1 PWM*1)
5. wire*31
6. tape
7. photoresistor*3
8. wooden sticks*12
9. cartons*2
10. sensor*1
11. table tennis ball*1
12. few cardboards
13. tools for cutting
14. USB-B
Put All the Components in Place
1.Prepare all the supplies
2.Put them in place as the image above
Type the Computer Programs
1.void setup(){ // put your setup code here, to run once:
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps pinMode( 9 , OUTPUT); // sets the digital pin as output pinMode( 6 , OUTPUT); // sets the digital pin as output pinMode( 7 , OUTPUT); // sets the digital pin as output pinMode( 2 , OUTPUT); // sets the digital pin as output pinMode( 4 , OUTPUT); // sets the digital pin as output pinMode( 12 , OUTPUT); // sets the digital pin as output _color = random( 0 , 3 ) ;
}
void loop(){ // put your main code here, to run repeatedly: Serial.print(_color); //print message Serial.print(" "); //print a blank Serial.println(); if ( _color == 0 ) { digitalWrite( 9 , HIGH ); // sets the digital pin on/off a(); } if ( _color == 1 ) { digitalWrite( 6 , HIGH ); // sets the digital pin on/off b(); } if ( _color == 2 ) { digitalWrite( 7 , HIGH ); // sets the digital pin on/off c(); } }
void b() { //customised function if ( analogRead( A5 ) < 555 ) { digitalWrite( 2 , HIGH ); // sets the digital pin on/off delay( 1000 ); // waits a few milliseconds digitalWrite( 6 , LOW ); // sets the digital pin on/off _color = random( 0 , 3 ) ; } else { digitalWrite( 2 , LOW ); // sets the digital pin on/off digitalWrite( 4 , LOW ); // sets the digital pin on/off digitalWrite( 9 , LOW ); // sets the digital pin on/off digitalWrite( 12 , LOW ); // sets the digital pin on/off } }
void c() { //customised function if ( analogRead( A4 ) < 555 ) { digitalWrite( 4 , HIGH ); // sets the digital pin on/off delay( 1000 ); // waits a few milliseconds digitalWrite( 7 , LOW ); // sets the digital pin on/off _color = random( 0 , 3 ) ; } else { digitalWrite( 2 , LOW ); // sets the digital pin on/off digitalWrite( 4 , LOW ); // sets the digital pin on/off digitalWrite( 7 , LOW ); // sets the digital pin on/off digitalWrite( 12 , LOW ); // sets the digital pin on/off } }
void a() { //customised function if ( analogRead( A0 ) < 555 ) { digitalWrite( 12 , HIGH ); // sets the digital pin on/off delay( 1000 ); // waits a few milliseconds digitalWrite( 9 , LOW ); // sets the digital pin on/off _color = random( 0 , 3 ) ; } else { digitalWrite( 2 , LOW ); // sets the digital pin on/off digitalWrite( 4 , LOW ); // sets the digital pin on/off digitalWrite( 6 , LOW ); // sets the digital pin on/off digitalWrite( 12 , LOW ); // sets the digital pin on/off } }
void s() { //customised function if ( analogRead( A4 ) < 555 ) { digitalWrite( 4 , HIGH ); // sets the digital pin on/off delay( 1000 ); // waits a few milliseconds _color = random( 0 , 3 ) ; } else { digitalWrite( 4 , LOW ); // sets the digital pin on/off digitalWrite( 12 , LOW ); // sets the digital pin on/off digitalWrite( 2 , LOW ); // sets the digital pin on/off digitalWrite( 7 , LOW ); // sets the digital pin on/off } }
2.int UltrasonicSensorCM(int trigPin, int echoPin) //Ultrasonic Sensor Code Auto Generated Return CM max distance 200
{ long duration; pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(20); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); duration = duration / 59; if ((duration < 2) || (duration > 200)) return false; return duration; }
void setup(){ // put your setup code here, to run once: digitalWrite( 6 , LOW ); //set ultrasonic sensor trigPin
pinMode( 11 , OUTPUT); // sets the digital pin as output pinMode( 13 , OUTPUT); // sets the digital pin as output }
void loop(){ // put your main code here, to run repeatedly: if ( UltrasonicSensorCM( 6 , 7 ) < 2 ) { digitalWrite( 11 , HIGH ); // sets the digital pin on/off delay( 10 ); // waits a few milliseconds digitalWrite( 13 , HIGH ); // sets the digital pin on/off } else { digitalWrite( 11 , LOW ); // sets the digital pin on/off digitalWrite( 13 , LOW ); // sets the digital pin on/off } }
Set Up the Game
1. Cut necessary holes
2. put the wooden sticks in place
3. REMEMBER to make holes for the USB-B transfer line to go pass