A booth game, for Carnival:
www.contrib.andrew.cmu.edu/~lea/state.pdf
This is a digital book reader. When the front cover is opened, a photosensor reads HIGH to display the title page. The page is attached to a motor, which in this case is used backwards as a generator and switch. When the page is turned, it rotates the motor, causing an input pin to read HIGH and provide electricity to generate the next page’s text on a digital ink display. Everytime you turn the page 360 degrees, you generate a new page, so it simulates turning the pages of an analog book. The text (which in my case will be displayed in Processing) has a feature to save a section of the page as an image in the margin by drawing a box around it. You can view that image full-screen by clicking on it in the margin.

Please check out the PDF for my State Machine :)
I did a state machine for my garmin, which is just a car GPS device thing.

So my idea for this state machine is to build a simple toy that uses an accelerometer to gauge how violently a toy is being played with. The idea is that, after you turn the toy on, the toy will go into attract mode, where it will blink an LED. Then, when the accelerometer senses movement, it will go into play mode, blinking multiple LED’s. Now the fun part is, if you shake the toy too violently and the accelerometer crosses a thresh hold, then an alarm will go off signaling the user to put the toy down or slow down. It is a simple idea, but i wanted to further explore an accelerometer while using analog input instead of digital input.
The state machine here shows how my Personal Medication Tracker works. This device is a tool that helps keep track of medication intake. So it begins by waiting for a patient. Once a patient stands on a mat (with a button sensor beneath it), the device recognizes that a patient is standing there, and prints onto the screen “Personal Medication Tracker, Name:, and Date:” Then it begins by asking a yes or no question on the screen, the answer would print onto the screen following the question. Then there is a delay until it is time to take the next medication. Then the next question is asked, and the answer in printed. Another delay until it is time to take the last medication. Then the last question is asked, and the answer is printed.
This information can be printed for the patient’s reference. There is also space for the patient to fill out their name and date.
(To refresh the device for the next day, simply press the refresh button on the arduino.)
int switch1 = 5; // patient sensor
int switch2 = 3; // "yes" button
int switch3 = 6; // "no" button
int led1 = 2; // morning pill 1
int led2 = 1; // morning pill 2
int led3 = 4; // afternoon pill 1
int led4 = 7; // dinner pill 1
int led5 = 8; // dinner pill 2
void setup ()
{
pinMode (switch1, INPUT);
pinMode (switch2, INPUT);
pinMode (switch3, INPUT);
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
pinMode (led5, OUTPUT);
Serial.begin (9600);
}
void loop ()
{
if (digitalRead(switch1==HIGH)){
{
Serial.println ("Personal Medication Tracker");
Serial.println ("Name:");
Serial.println ("Date:");
Serial.println ("");
Serial.println ("Did you take your morning pills?");
YESorNOmorning ();
Serial.println ("Did you take your afternoon pills?");
YESorNOafternoon ();
Serial.println ("Did you take your night pills?");
YESorNOnight ();
}
}
}
void YESorNOmorning ()
{
delay (5000);
if (digitalRead(switch2==HIGH))
{
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
Serial.println ("YES");
Serial.println ("");
}
if (digitalRead(switch3==HIGH))
{
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
Serial.println ("NO");
Serial.println ("");
}
delay(5000);
}
void YESorNOafternoon ()
{
delay (1000);
if (digitalRead(switch2==HIGH))
{
digitalWrite(led3,HIGH);
Serial.println ("YES");
Serial.println ("");
}
if (digitalRead(switch3==HIGH))
{
digitalWrite(led3,LOW);
Serial.println ("NO");
Serial.println ("");
}
delay(5000);
}
void YESorNOnight ()
{
delay (1000);
if (digitalRead(switch2==HIGH))
{
digitalWrite(led4,HIGH);
digitalWrite(led5,HIGH);
Serial.println ("YES");
Serial.println ("");
}
if (digitalRead(switch3==HIGH))
{
digitalWrite(led4,LOW);
digitalWrite(led5,LOW);
Serial.println ("NO");
Serial.println ("");
}
delay(5000);
}
revised code
int switch1 = 5; // patient sensor
int switch2 = 3; // "yes" button
int switch3 = 6; // "no" button
int led1 = 2; // morning pill 1
int led2 = 1; // morning pill 2
int led3 = 4; // afternoon pill 1
int led4 = 7; // dinner pill 1
int led5 = 8; // dinner pill 2
void setup ()
{
pinMode (switch1, INPUT);
pinMode (switch2, INPUT);
pinMode (switch3, INPUT);
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
pinMode (led5, OUTPUT);
Serial.begin (9600);
}
void loop ()
{
if (digitalRead(switch1==HIGH)){ // start machine at 8:00 am
{ //
Serial.println ("Personal Medication Tracker");
Serial.println ("Name:"); //
Serial.println ("Date:"); //
Serial.println (""); //
Serial.println ("Did you take your morning pills?");
YESorNOmorning (); //
delay (14400000); // 12:00pm
Serial.println ("Did you take your afternoon pills?");
YESorNOafternoon (); //
delay (21600000); // 6:00pm
Serial.println ("Did you take your night pills?");
YESorNOnight (); //
delay (50400000); // 8:00am
}
}
}
void YESorNOmorning () // when it's morning
{
delay (5000); // delay 5 seconds
if (digitalRead(switch2==HIGH)) // when "yes" button is pressed
{
digitalWrite(led1,HIGH); // morning medicine 1 taken, led goes on
digitalWrite(led2,HIGH); // morning medicine 2 taken, led goes on
Serial.println ("YES"); // print "yes"
Serial.println ("");
}
if (digitalRead(switch3==HIGH)) // when "no" button is pressed
{
digitalWrite(led1,LOW); // morning medicine 1 not taken, led stays off
digitalWrite(led2,LOW); // morning medicine 2 not taken, led stays off
Serial.println ("NO"); // print "no"
Serial.println ("");
}
delay(5000); // delay 5 seconds
}
void YESorNOafternoon () // when it's afternoon
{
delay (5000); // delay 5 seconds
if (digitalRead(switch2==HIGH)) // when "yes" button is pressed
{
digitalWrite(led3,HIGH); // morning afternoon medicine 1 taken, led goes on
Serial.println ("YES"); // print "yes"
Serial.println ("");
}
if (digitalRead(switch3==HIGH)) // when "no" button is pressed
{
digitalWrite(led3,LOW); // afternoon medicine 1 not taken, led stays off
Serial.println ("NO"); // print "no"
Serial.println ("");
}
delay(5000); // delay 5 seconds
}
void YESorNOnight () // when night
{
delay (1000);
if (digitalRead(switch2==HIGH)) // when "yes" button is pressed
{
digitalWrite(led4,HIGH); // night medicine 1 taken, led goes on
digitalWrite(led5,HIGH); // night medicine 2 taken, led goes on
Serial.println ("YES"); // print "yes"
Serial.println ("");
}
if (digitalRead(switch3==HIGH)) // when "no" button is pressed
{
digitalWrite(led4,LOW); // night medicine 1 not taken, led stays off
digitalWrite(led5,LOW); // night medicine 2 not taken, led stays off
Serial.println ("NO"); // print "no"
Serial.println ("");
}
delay(5000); // delay 5 seconds
}
//
Continuing with the 3D Mirror concept, I want to luminate each moving block according to its position, so as it moves it’s constanting changing color.