I modified the SinglePotControlsBrightness.txt and Control3LEDsWith3Pots.txt code to map rotational position to LEDs for use in the children's fortune teller oragami game. A person begins play by choosing a color (red, blue or green) and moving the fortune teller the number of letters of in the color's name. Each move of the fortune teller changes the rotational position, changing the color of LEDs. The resulting color then determines the player's next number of moves, (three for red, four for blue, etc.). Thus, instead of using numbers drawn on the fortune teller to make the next move, the number of letters in each color are used to advance game play.
analogue fortune teller game
/*
* Daniela Rosner
* Modified one pot fades one led for fortune teller game
* Modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
*/
int potPin = 2; // select the input pin for the potentiometer
//int ledPin = 9; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
int redLedPin = 9; // select the pins for the LEDs
int greenLedPin = 10;
int blueLedPin = 11;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
r = 0;
g = 0;
b = 0;
Serial.println(val);
if (val/4 < 80) {
r = 255;
} else if (val/4 < 160) {
g = 255;
} else {
b = 255;
}
analogWrite(redLedPin,r);
analogWrite(greenLedPin, g);
analogWrite(blueLedPin, b);
}
Comments
oooh, daniela, this is so
oooh, daniela, this is so cute! I hope someday I'll get to see it :)