
No reason. No reason at all.
Why?
So many people ask the same question to so many ideas: why? And I answer so many of those questions with the same two words: why not?
What’s an Arduino?
If you don’t already know, an Arduino is an open-source hardware and software physical computing platform. So what’s that mean? Basically, you are given a very elegant language to program the Arduino circuit board with, and a very easy to use board to connect many kinds of sensors and output devices. It enables you to make things physically happen rather than just show up on a monitor!
Why Go To So Much Trouble?
The problem I’ve always seemed to run into is that, with Windows’ clunkiness and the fact there are many other applications running at the same time, it doesn’t go fast enough. Since it doesn’t go fast enough, you can’t accurately time a human reflex. While an Arduino runs at 16 MHz, and that’s not technically faster than an average computer, the Arduino runs a much lighter ”operating system,” enabling it to run faster.
So… How?
This configuration depends on there being a jumbo LED on pin 13 of the Arduino and a switch with a 10k pull-down resistor configuration on pin 2. It will spit out some data to serial, which does need a program or your brain to comprehend. That said, here’s my hypothetical and untested code:
int lightPin = 13;
int buttonPin = 2;
int cyclesGlobal = 0;
boolean isTesting = false;
boolean killLoop = false;
void setup()
{
pinMode(lightPin, OUTPUT);
pinMode(buttonPin, INPUT);
serial.begin(9600);
}
void erraticSignal()
{
digitalWrite(lightPin, HIGH);
delay(200);
digitalWrite(lightPin, LOW);
delay(100);
digitalWrite(lightPin, HIGH);
delay(200);
digitalWrite(lightPin, LOW);
delay(100);
digitalWrite(lightPin, HIGH);
delay(200);
digitalWrite(lightPin, LOW);
delay(1000);
}
void alertStart()
{
serial.println(246, DEC);
}
void lightOn()
{
digitalWrite(lightPin, HIGH);
}
void lightOff()
{
digitalWrite(lightPin, LOW);
}
void startTiming()
{
for(long i=0; i <= 10000; i++)
{
if (killLoop == true)
{
break;
}
delay(1);
cyclesGlobal = l;
}
lightOff();
cleanup();
}
void phoneHome()
{
serial.print(135, DEC);
serial.println();
serial.println(cyclesGlobal);
}
void stopTimer()
{
detachInterrupt(0);
phoneHome();
killLoop = true;
cleanup();
}
void cleanup()
{
lightOff();
cyclesGlobal = 0;
isTesting = false;
killLoop = false;
}
void startTesting()
{
isTesting = true;
startWaiting()
attachInterrupt(0, stopTimer(), RISING)
lightOn()
startTiming()
}
void startWaiting()
{
delay(random(2000, 10000));
}
void loop()
{
if (digitalRead(buttonPin) == HIGH)
{
if (isTesting != true)
{
erraticSignal()
alertStart()
startTesting()
}
}
}