Saturday, May 16, 2015

The Game of Reflex

by J.B. Wylzan


Project 12: The Game of Reflex
This is a physics game about reaction time. The first one who presses the button and turns on the set of leds wins the game.


Block Diagram:
Image provided by Fritzing
Hardware:
LEDs
resistors
switch buttons
wires
breadboard
computer cable
Arduino UNO

Actual Assembly:  



Procedure:
1. Use the same prototype as shown above
2. Run the Arduino Interface
3. Select File > New
4. Copy Code #12  below
5. Paste Code #12
6. Click File > Save
7. Click Verify
8. Click Upload
9. Activate a set of Leds using either switch A or switch B

Code # 12:  
/*
  iHackLab Game of Impulse
  powered by Arduino
  sketched by J.B. Wylzan
  modified by Lawsinium

  Turns a set of Leds using either switch A or switch B
  This example code is public domain.
 */

 // Setup pins 3 to 11 as output; 2 and12 as inputs
void setup() 
 {
  pinMode(2, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
 }

// Procedure to turn a set of leds using either button A or button B
void loop() {
if (digitalRead(2) == 0) {
  digitalWrite(4, HIGH);   // turn the LED on 
  digitalWrite(5, HIGH);   // turn the LED on 
  digitalWrite(6, HIGH);   // turn the LED on 
  digitalWrite(7, HIGH);   // turn the LED on 
  digitalWrite(9, LOW);   // turn the LED on
  digitalWrite(10, LOW);   // turn the LED on
  digitalWrite(11, LOW);   // turn the LED on
  digitalWrite(3, LOW);   // turn the LED on
}
else
{
  if (digitalRead(12) == 0) {
  digitalWrite(4, LOW);   // turn the LED on 
  digitalWrite(5, LOW);   // turn the LED on 
  digitalWrite(6, LOW);   // turn the LED on 
  digitalWrite(7, LOW);   // turn the LED on 
  digitalWrite(9, HIGH);   // turn the LED on
  digitalWrite(10, HIGH);   // turn the LED on
  digitalWrite(11, HIGH);   // turn the LED on
  digitalWrite(3, HIGH);   // turn the LED on
   }
}
}

/*    End of Program       */


Project # 13: The Wave Symphony



Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: A Journal of a Creative Mind, Joey Lawsin, 1988, USA.


"The Last Human on Earth will no longer be Human." ~ Joey Lawsin
================================================================== 
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®



 ================================================================== 

No comments:

Post a Comment