Last active
May 6, 2024 08:11
-
-
Save kobeBigs/9522750 to your computer and use it in GitHub Desktop.
SimonSays Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title | |
SimonSays Game | |
# Picture | |
media: http://www.deviantsart.com/fddvrk.jpg | |
# Objective | |
The goal of this project is to replicate the SimonSays Game for kids. The project employs few modifications to the Simon Says Arduino Game; implements an LCD and uses local native audio/tones. | |
# Duration | |
8 hours | |
# Age Group | |
all | |
# Materials | |
## Arduino | |
* description:Arduino UNO | |
* quantity:1 | |
* price: | |
* link: | |
## LED | |
* description:Colorful LEDs(Red, Green, Blue, Yellow) | |
* quantity:4 | |
* price:0.20p | |
* link:undefined | |
## Push Button | |
* description:Press to release buttons | |
* quantity:4 | |
* price:0.50p | |
* link:undefined | |
## Resistors | |
* description:330 Ohms Resistors | |
* quantity:4 | |
* price:undefined | |
* link:undefined | |
## Jumper Wires | |
* description:undefined | |
* quantity:undefined | |
* price:undefined | |
* link:undefined | |
## Breadboard | |
* description:undefined | |
* quantity:1 | |
* price:undefined | |
* link:undefined | |
## 9V Battery | |
* description:undefined | |
* quantity:1 | |
* price:undefined | |
* link:undefined | |
## Battery Connector | |
* description:undefined | |
* quantity:1 | |
* price:undefined | |
* link:undefined | |
## Battery Holder | |
* description:(optional) | |
* quantity:1 | |
* price:undefined | |
* link:undefined | |
## undefined | |
* description:undefined | |
* quantity:undefined | |
* price:undefined | |
* link:undefined | |
# Steps | |
## Assemble Parts | |
media: http://www.deviantsart.com/2rfcftf.jpg | |
notes: Identify and assemble parts/materials. | |
## Wire-up | |
media: http://www.deviantsart.com/3jsgjo6.jpg | |
notes: 1. | |
## Sketch | |
media: undefined | |
notes: undefined | |
## Test | |
media: undefined | |
notes: undefined | |
## Finish | |
media: undefined | |
notes: undefined | |
# Notes | |
undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Desc: SimonSays Game | |
Author: Kobe Subramaniam(@kobebigs) | |
http://kobebigs.com | |
Date: March 12, 2014 | |
*/ | |
boolean led[] = {8, 9, 10, 11}; | |
boolean btn[] = {2, 3, 4, 5}; | |
int rounds = 0; // rounds counter | |
int btnState = 0; // button state checker | |
int randomArray[100]; | |
int inputArray[100]; | |
void setup(){ | |
Serial.begin(9600); | |
for(int x=0; x<4; x++){ | |
pinMode(led[x], OUTPUT); | |
} | |
for(int x=0; x<4; x++){ | |
pinMode(btn[x], INPUT); | |
digitalWrite(btn[x], HIGH); | |
} | |
randomSeed(analogRead(0)); //to generate more randomness | |
delay(1000); | |
} | |
void loop(){ | |
for (int y=0; y<=99; y++){ | |
//generate array/light | |
digitalWrite(led[0], HIGH); | |
digitalWrite(led[1], HIGH); | |
digitalWrite(led[2], HIGH); | |
digitalWrite(led[3], HIGH); | |
//dim or shut led | |
digitalWrite(led[0], LOW); | |
digitalWrite(led[1], LOW); | |
digitalWrite(led[2], LOW); | |
digitalWrite(led[3], LOW); | |
delay(1000); | |
for (int y=rounds; y <= rounds; y++){ | |
Serial.println(""); | |
Serial.print("Round: "); | |
Serial.print(y); | |
Serial.println(""); | |
randomArray[y] = random(1, 5); //Assign a random no. of 1-4 for rounds count | |
for (int x=0; x <=rounds; x++){ | |
Serial.print(randomArray[x]); | |
for(int y=0; y<4; y++){ | |
if (randomArray[x] == 1 && led[y] == 8){ | |
digitalWrite(led[y], HIGH); | |
delay(400); | |
digitalWrite(led[y], LOW); | |
delay(100); | |
} | |
if (randomArray[x] == 2 && led[y] == 9){ | |
digitalWrite(led[y], HIGH); | |
delay(400); | |
digitalWrite(led[y], LOW); | |
delay(100); | |
} | |
if (randomArray[x] == 3 && led[y] == 10){ | |
digitalWrite(led[y], HIGH); | |
delay(400); | |
digitalWrite(led[y], LOW); | |
delay(100); | |
} | |
if (randomArray[x] == 4 && led[y] == 11){ | |
digitalWrite(led[y], HIGH); | |
delay(400); | |
digitalWrite(led[y], LOW); | |
delay(100); | |
} | |
} | |
} | |
} | |
input(); | |
} | |
} | |
//---------------------------------- | |
// Function to allow user input and check against generated array | |
//---------------------------------------- | |
void input() { | |
for (int x=0; x <= rounds;){ | |
for(int y=0; y<4; y++){ | |
btnState = digitalRead(btn[y]); | |
//check for button pushed | |
if (btnState == LOW && btn[y] == 2){ | |
digitalWrite(led[0], HIGH); | |
delay(200); | |
digitalWrite(led[0], LOW); | |
inputArray[x] = 1; | |
delay(250); | |
Serial.print(" "); | |
Serial.print(1); | |
// check input, if not the same call the fail function | |
if (inputArray[x] != randomArray[x]){ | |
fail(); | |
} | |
x++; | |
} | |
if (btnState == LOW && btn[y] == 3){ | |
digitalWrite(led[1], HIGH); | |
delay(200); | |
digitalWrite(led[1], LOW); | |
inputArray[x] = 2; | |
delay(250); | |
Serial.print(" "); | |
Serial.print(2); | |
if (inputArray[x] != randomArray[x]){ | |
fail(); | |
} | |
x++; | |
} | |
if (btnState == LOW && btn[y] == 4){ | |
digitalWrite(led[2], HIGH); | |
delay(200); | |
digitalWrite(led[2], LOW); | |
inputArray[x] = 3; | |
delay(250); | |
Serial.print(" "); | |
Serial.print(3); | |
if (inputArray[x] != randomArray[x]) { | |
fail(); | |
} | |
x++; | |
} | |
if (btnState == LOW && btn[y] == 5){ | |
digitalWrite(led[3], HIGH); | |
delay(200); | |
digitalWrite(led[3], LOW); | |
inputArray[x] = 4; | |
delay(250); | |
Serial.print(" "); | |
Serial.print(4); | |
if (inputArray[x] != randomArray[x]){ | |
fail(); | |
} | |
x++; | |
} | |
} | |
} | |
delay(500); | |
rounds++; | |
} | |
//-------------------------- | |
// Fail() - function to exec when player fails to match the sequence | |
//------------------------------------------ | |
void fail(){ | |
for (int y=0; y<=2; y++){ | |
digitalWrite(led[0], HIGH); | |
digitalWrite(led[1], HIGH); | |
digitalWrite(led[2], HIGH); | |
digitalWrite(led[3], HIGH); | |
delay(200); | |
digitalWrite(led[0], LOW); | |
digitalWrite(led[1], LOW); | |
digitalWrite(led[2], LOW); | |
digitalWrite(led[3], LOW); | |
delay(200); | |
} | |
delay(500); | |
rounds =-1; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"id":"9522750","user":"kobeBigs","description":"SimonSays Game","urls":["http://www.deviantsart.com/r636rs.jpg","undefined","undefined","undefined","undefined","undefined"],"raw":"# Title \nSimonSays Game\n# Picture \nmedia: http://www.deviantsart.com/r636rs.jpg\n# Objective\nThe goal of this project is to replicate the SimonSays Game for kids. The project employs few modifications to the Simon Says Arduino Game; implements an LCD and uses local native audio/tones.\n# Duration\n8 hours\n# Age Group\nall\n# Materials\n## Arduino\n* description:Arduino UNO\n* quantity:1\n* price:\n* link:\n\n## LED\n* description:Colorful LEDs(Red, Green, Blue, Yellow)\n* quantity:4\n* price:0.20p\n* link:undefined\n\n## Push Button\n* description:Press to release buttons\n* quantity:4\n* price:0.50p\n* link:undefined\n\n## Resistors\n* description:330 Ohms Resistors\n* quantity:4\n* price:undefined\n* link:undefined\n\n## Jumper Wires\n* description:undefined\n* quantity:undefined\n* price:undefined\n* link:undefined\n\n## Breadboard\n* description:undefined\n* quantity:1\n* price:undefined\n* link:undefined\n\n## 9V Battery\n* description:undefined\n* quantity:1\n* price:undefined\n* link:undefined\n\n## Battery Connector\n* description:undefined\n* quantity:1\n* price:undefined\n* link:undefined\n\n## Battery Holder\n* description:(optional)\n* quantity:1\n* price:undefined\n* link:undefined\n\n## undefined\n* description:undefined\n* quantity:undefined\n* price:undefined\n* link:undefined\n\n# Steps\n## Assemble Parts\nmedia: undefined\n\nnotes: Identify parts\n\n## Wire-up\nmedia: undefined\n\nnotes: undefined\n\n## Sketch\nmedia: undefined\n\nnotes: undefined\n\n## Test\nmedia: undefined\n\nnotes: undefined\n\n## Finish\nmedia: undefined\n\nnotes: undefined\n\n# Notes\nundefined\n","steps":[{"description":"Assemble Parts","$$hashKey":"009","notes":"Identify and assemble parts/materials.","picture":"http://www.deviantsart.com/2rfcftf.jpg","media":"http://www.deviantsart.com/2rfcftf.jpg"},{"$$hashKey":"00U","description":"Wire-up","picture":"http://www.deviantsart.com/3jsgjo6.jpg","media":"http://www.deviantsart.com/3jsgjo6.jpg","notes":"1."},{"$$hashKey":"00X","description":"Sketch"},{"$$hashKey":"010","description":"Test"},{"$$hashKey":"013","description":"Finish"}],"materials":[{"item":"Arduino","description":"Arduino UNO","quantity":"1","price":"","link":"","$$hashKey":"007"},{"$$hashKey":"00C","item":"LED","description":"Colorful LEDs(Red, Green, Blue, Yellow)","quantity":"4","price":"0.20p"},{"$$hashKey":"00E","item":"Push Button","description":"Press to release buttons","quantity":"4","price":"0.50p"},{"$$hashKey":"00G","item":"Resistors","description":"330 Ohms Resistors","quantity":"4"},{"$$hashKey":"00I","item":"Jumper Wires"},{"$$hashKey":"00K","item":"Breadboard","quantity":"1"},{"$$hashKey":"00M","item":"9V Battery","quantity":"1"},{"$$hashKey":"00O","item":"Battery Connector","quantity":"1"},{"$$hashKey":"00Q","item":"Battery Holder","description":"(optional)","quantity":"1"},{"$$hashKey":"00S"}],"title":"SimonSays Game","picture":"http://www.deviantsart.com/fddvrk.jpg","media":"http://www.deviantsart.com/fddvrk.jpg","objective":"The goal of this project is to replicate the SimonSays Game for kids. The project employs few modifications to the Simon Says Arduino Game; implements an LCD and uses local native audio/tones.","duration":"8 hours","ageGroup":"all","content":"<h1>Title</h1>\n\n<p>SimonSays Game</p>\n\n<h1>Picture</h1>\n\n<p>{{0}}</p>\n\n<h1>Objective</h1>\n\n<p>The goal of this project is to replicate the SimonSays Game for kids. The project employs few modifications to the Simon Says Arduino Game; implements an LCD and uses local native audio/tones.</p>\n\n<h1>Duration</h1>\n\n<p>8 hours</p>\n\n<h1>Age Group</h1>\n\n<p>all</p>\n\n<h1>Materials</h1>\n\n<h2>Arduino</h2>\n\n<ul>\n<li>description:Arduino UNO</li>\n<li>quantity:1</li>\n<li>price:</li>\n<li>link:</li>\n</ul>\n\n<h2>LED</h2>\n\n<ul>\n<li>description:Colorful LEDs(Red, Green, Blue, Yellow)</li>\n<li>quantity:4</li>\n<li>price:0.20p</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Push Button</h2>\n\n<ul>\n<li>description:Press to release buttons</li>\n<li>quantity:4</li>\n<li>price:0.50p</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Resistors</h2>\n\n<ul>\n<li>description:330 Ohms Resistors</li>\n<li>quantity:4</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Jumper Wires</h2>\n\n<ul>\n<li>description:undefined</li>\n<li>quantity:undefined</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Breadboard</h2>\n\n<ul>\n<li>description:undefined</li>\n<li>quantity:1</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>9V Battery</h2>\n\n<ul>\n<li>description:undefined</li>\n<li>quantity:1</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Battery Connector</h2>\n\n<ul>\n<li>description:undefined</li>\n<li>quantity:1</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>Battery Holder</h2>\n\n<ul>\n<li>description:(optional)</li>\n<li>quantity:1</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h2>undefined</h2>\n\n<ul>\n<li>description:undefined</li>\n<li>quantity:undefined</li>\n<li>price:undefined</li>\n<li>link:undefined</li>\n</ul>\n\n<h1>Steps</h1>\n\n<h2>Assemble Parts</h2>\n\n<p>{{1}}</p>\n\n<p>notes: Identify and assemble parts/materials.</p>\n\n<h2>Wire-up</h2>\n\n<p>{{2}}</p>\n\n<p>notes: 1.</p>\n\n<h2>Sketch</h2>\n\n<p>{{3}}</p>\n\n<p>notes: undefined</p>\n\n<h2>Test</h2>\n\n<p>{{4}}</p>\n\n<p>notes: undefined</p>\n\n<h2>Finish</h2>\n\n<p>{{5}}</p>\n\n<p>notes: undefined</p>\n\n<h1>Notes</h1>\n\n<p>undefined</p>","ownedByMe":"true"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment