this is an idea for a better tealight. My goal is to fit the entire thing in a 1" cylinder with a thickness, excluding protruding LED, of 1/2". I don't know if I can fit everything on the board, but if I can I'll draw up custom boards.
Flicker code for anyone who can get it to work. /* FlickerFlame Swift 05-27-14 I started with the Blink example and added a simple random number generator. */
//use these values to tweak the effect to your liking. int ledpin = 1; //pin for the LED int intensity = 250; //this is the current intensity for the LED int Die; //juse a temporary place to store a value int FlickerAmount = 50; //this controls the size of the flicker.
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(ledpin, OUTPUT);
randomSeed(analogRead(0));
}
// the loop routine runs over and over again forever: void loop() { Die = random(1,3); //roll a D3 if (Die == 1) intensity-=FlickerAmount; //on a 1 it gets dimmer if (Die == 2) intensity+=FlickerAmount; //on a 2 it gets brighter //on a 3 it does not change if (intensity > 250) intensity = 250; //flame has a max value if (intensity < 50) intensity = 50; //flame has a min value
analogWrite(ledpin,intensity); //output delay(100); //this determines the frequency of the flicker. }
Product | Subtotal | Qty | |
---|---|---|---|
AVR 8 Pin 20MHz 8K 4A/D - ATtiny85
COM-09378 |
3.5 | 1 | |
SPDT Slide Switch
COM-09609 |
0.95 | 1 | |
Super Bright LED - Yellow 10mm
COM-11119 |
1.85 |
1
Cannot be ordered at this time. |
|
DIP Sockets Solder Tail - 8-Pin
PRT-07937 |
0.55 | 1 | |
ProtoBoard - Round 1"
PRT-08809 |
2.95 |
1
Cannot be ordered at this time. |
|
Coin Cell Battery Holder - 12mm (PTH)
PRT-07948 |
4.8 | 3 | |
Button Cell Battery - 11.6mm (LR44)
PRT-11305 |
2.85 | 3 | |
Total: 17.45 |