Changes

Jump to: navigation, search

Students/Angela Kim

3,656 bytes added, 01:14, 19 March 2010
no edit summary
EDIT:
Though I tried extremely hard to make the POV bike work, I couldn't with my still-novice electronics skills...And so, my next project idea was this: a donut eating elephant... HAMILTON, THE DONUT EATING ELEPHANT!
I've lately rediscovered the out-of-this-world goodness of Krispy Kreme - but I've also remembered that there is such thing as too much of a good thing. I feel like donuts are one of those things that can easily cross straddle the border from amazing to between delicious and sickening. On one of my trips there with my roommate, we got these paper hats that say "EAT KRISPY KREME DONUTS." I thought it was hilarious that the hat commanded people to eat their donuts... I decided to poke fun at this a little bit.
I made an elephant doll that looks like your average children's toy. Then I put a 7 segment LED display right after the word "EAT" on the Krispy Kreme hat and put it on the doll. This led is hooked up to a PCB that is tucked in the hat, and then wired to the Arduino which is hidden in the ear of the elephant. I programmed the Arduino to display numbers on the LED. There is also breadboard hidden in the elephant's belly, which holds a normally open reed switch. The reed switch closes the circuit everytime it senses a magnet nearby.
So what I did was make a felt donut with magnets inside. Every time HAMILTON the elephant is "fed" a donut, the reed switch closes its circuit, thus making the LED display on his hat go up one, making the hat display "EAT # KRISPY KREME DONUTS." Because I only had access to one LED display, the numbers only go up to 9, and then resets to 0.
 
code:
// Seven-segment LED Display
// Common Anode pins 3 and 8
 
// G F + A B
// | | | | | -> pins and segments they control
// ---------
// F| A |B
// |---G---| -> segments
// E| D |C
// ---------
// | | | | | -> pins and segments they control
// E D + C DP
 
// Segments that make each number when lit:
// 0 => ABCDEF
// 1 => BC
// 2 => ABDEG
// 3 => ABCDG
// 4 => BCFG
// 5 => ACDFG
// 6 => ACDEFG
// 7 => ABC
// 8 => ABCDEFG
// 9 => ABCDFG
 
// Arduino digital pins used to light up
// corresponding segments on the LED display
#define A 0
#define B 1
#define C 2
#define D 3
#define E 4
#define F 5
#define G 6
 
// Pushbutton connected to pin 9
#define BUTTON 9
 
// Common cathode;
// on when pin is high
// and off when pin is low
#define ON HIGH
#define OFF LOW
 
int count = 0; // current display count
int val = 0; // digital input from button
 
void setup() {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(E, OUTPUT);
pinMode(F, OUTPUT);
pinMode(G, OUTPUT);
pinMode(BUTTON, INPUT);
zero();
}
 
void loop() {
val = digitalRead(BUTTON);
if (val == LOW) {
count++;
delay(400);
switch (count) {
case 0:
zero();
break;
case 1:
one();
break;
case 2:
two();
break;
case 3:
three();
break;
case 4:
four();
break;
case 5:
five();
break;
case 6:
six();
break;
case 7:
seven();
break;
case 8:
eight();
break;
case 9: {
nine();
count = -1;
break;
}
}
}
}
 
// 0 => ABCDEF
void zero() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, ON);
digitalWrite(F, ON);
digitalWrite(G, OFF);
}
 
// 1 => BC
void one() {
digitalWrite(A, OFF);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, OFF);
digitalWrite(E, OFF);
digitalWrite(F, OFF);
digitalWrite(G, OFF);
}
 
// 2 => ABDEG
void two() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, OFF);
digitalWrite(D, ON);
digitalWrite(E, ON);
digitalWrite(F, OFF);
digitalWrite(G, ON);
}
 
// 3 => ABCDG
void three() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, OFF);
digitalWrite(F, OFF);
digitalWrite(G, ON);
}
 
// 4 => BCFG
void four() {
digitalWrite(A, OFF);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, OFF);
digitalWrite(E, OFF);
digitalWrite(F, ON);
digitalWrite(G, ON);
}
 
// 5 => ACDFG
void five() {
digitalWrite(A, ON);
digitalWrite(B, OFF);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, OFF);
digitalWrite(F, ON);
digitalWrite(G, ON);
}
 
// 6 => ACDEFG
void six() {
digitalWrite(A, ON);
digitalWrite(B, OFF);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, ON);
digitalWrite(F, ON);
digitalWrite(G, ON);
}
 
// 7 => ABC
void seven() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, OFF);
digitalWrite(E, OFF);
digitalWrite(F, OFF);
digitalWrite(G, OFF);
}
 
// 8 => ABCDEFG
void eight() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, ON);
digitalWrite(F, ON);
digitalWrite(G, ON);
}
 
// 9 => ABCDFG
void nine() {
digitalWrite(A, ON);
digitalWrite(B, ON);
digitalWrite(C, ON);
digitalWrite(D, ON);
digitalWrite(E, OFF);
digitalWrite(F, ON);
digitalWrite(G, ON);
(pictures to come)
38
edits

Navigation menu