Page 1 of 1

Cart : Beer-o-Matic random light thing

Posted: Sat Aug 30, 2008 4:15 pm
by Chris Alvey
We had talked about how it would be cool to hit a button and have some LEDs light up on the cart and pick a random beer for someone. I wonder if something like this (http://www.adafruit.com/index.php?main_ ... ucts_id=68) might work.

I know nothing about electronics, microprocessors, etc. (although I'd like to learn, and I think that's what this is for.) It looks to be programmable by computer and I know it can light up LED lights.

So, first off, do we have anyone that knows about electronics? Could that be done on this?

Might be fun.

edit: better/more info on the system http://www.arduino.cc/

edit again: use this kind of rig to build a temp controller http://www.radiolocman.com/shem/schemat ... l?di=33479

Posted: Sun Aug 31, 2008 12:30 pm
by Chris Norrick
I love adafruit. I have a few of her kits. I just finished the Minty Boost charger last night.

I was leaning toward a microcontroller route, but I think dwayne may have a simpler solution.

Posted: Thu Sep 04, 2008 2:52 pm
by Dutch
Are you looking for a "Wheel of Fortune" type of display or Roulette? Basically a circular arrangement with LEDs around the perimeter
I can put something together electronically using LEDs rather cheaply. One model has 10 LEDs and the second has 37 LEDs with sound as well!
Let me know - you've peaked my interest!

Posted: Fri Sep 05, 2008 6:11 am
by Chris Alvey
I'm not sure ... I think it was probably up to the inventor's imagination. What was Dwayne's idea?

I don't have any of the hardware but, just for fun I did write some C code to do this using the random function. It goes and lights up several random lights then finally stays on one after a button is pressed. The code below is terrible and needs to be made into arrays,etc. - so it's there only so you could see about what this would take.


:!: //////// WARNING - Nerdy Content Below ////////////////:!:

int inPin = 12; //assuming pin 12 is the input pin for a pushbutton

void setup()
{
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(0));

//randomSeed(9); //or not so random (wink)


//TODO: change this to an array() - for demo purposes only
pinMode(2, OUTPUT); //sets the digital pin 2 as output //do this once for each led plugged in
pinMode(3, OUTPUT); //set 3
pinMode(4, OUTPUT); //set 4, etc... to 11



//set the pushbutton
pinMode(inPin, INPUT); //declare pushbutton as input

}

void loop()
{
val = digitalRead(inPin) // read input value of pushbutton

if (val==HIGH){ //HIGH means it's pushed
//just go thru the thing 25 times and blink them on then off
for (int i=0; i <= 25; i++){
blinkLED(getRandomPin);
delay(1000);
}

//then just turn one on
digitalWrite(getRandomPin,HIGH);
}
else{
//do nothing, maybe make sure all are off here
}



}


int getRandomPin(){
int result;
result = random(1,11); //assuming pins 1 to 11 are used, for instance
return result;
}

void lightLED(int thisLED){
digitalWrite(thisLED, HIGH); //on
delay(1000);
digitalWrite(thisLED, LOW); //off
delay(1000);
}