Skip to content

Instantly share code, notes, and snippets.

View zach-c-d's full-sized avatar

Zach C. D. zach-c-d

  • Toronto, Ontario
View GitHub Profile
/*
SparkFun Inventor's Kit
Example sketch 16
SIMON SAYS
Simon Says is a memory game. Start the game by pressing one of the four buttons. When a button lights up,
press the button, repeating the sequence. The sequence will get longer and longer. The game is won after
13 rounds.
Generates random sequence, plays music, and displays button lights.
Simon tones from Wikipedia
//time the interval lengths
unsigned long prevMillis = 0;
unsigned long prevMillisButtonCheck = 0;
unsigned long prevMillisLEDCheck = 0;
unsigned long currentMillis;
//checks if button has been hit,
//if analogRead(button) exceeds the threshold
boolean buttonCheck = false;
int threshold = 500;
int button = 8;
void setup(){
pinMode(button, INPUT);
Serial.begin(9600);
}
unsigned long prevMillis = 0;
unsigned long prevMillisButtonCheck = 0;
unsigned long currentMillis;
boolean buttonCheck = false;
int count; //the number of button presses per interval
/*Common Algorithms*/
/*
i = x + (y * width)
//Index of Grid = X coordinate * (Y coordinate * width)
Math.floor(Math.random() + 0.5)
//Randomly chooses between 0 and 1
*/
window.onload = function(){
/*
#### # #### ##### ## # ####
# # # # # # # # # # #
# # # # ##### # # # ####
# ### # # # # # ###### # #
# # # # # # # # # # # #
#### ###### #### ##### # # ###### ####
*/
//pressure on pad where hit is registered
int hitThreshold = 780;
int centerPad = A0;
int rightPad = A1;
int bottomPad = A3;
int leftPad = A5;
int centerLED = 2;
int rightLED = 3;
int bottomLED = 4;
int leftLED = 7;
@zach-c-d
zach-c-d / simonBoxingV4.ino
Created August 17, 2017 18:07
checks all sensors for input and lights corresponding LED
int centerPad = A0;
int rightPad = A1;
int bottomPad = A3;
int leftPad = A5;
int centerLED = 2;
int rightLED = 3;
int bottomLED = 4;
int leftLED = 7;
@zach-c-d
zach-c-d / wayfinding.js
Last active August 18, 2017 07:08
Prints a grid to the console filled with random binary data
/*Common Algorithms*/
/*
i = x + (y * width)
//Index of Grid = X coordinate * (Y coordinate * width)
Math.floor(Math.random() + 0.5)
//Randomly chooses between 0 and 1
*/
function Grid(x,y){
Bugs found in ubuntu mate beta:
Firfox can freeze system if downloading compressed file and opening containing folder from downloads button menu in firefox
-can only right click the shutdown button in top right menu bar
-sometimes can not select an option in the shutdown menu
-accessing from the all-downloads window also frozen firefox
Independant of firefox, sometimes you can only right click the shutdown button on the menu bar
/*This sketch is a simple version of the famous Simon Says game. You can use it and improved it adding
levels and everything you want to increase the diffuculty!
There are five buttons connected to A0, A1, A2, A3 and A4.
The buttons from A0 to A3 are used to insert the right sequence while A4 to start the game.
When a wrong sequence is inserted all the leds will blink for three time very fast otherwhise the
inserted sequence is correct.
Hardware needed: