Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //neon light startup
- //To be used the turn on the neon lights in a store or other facility that uses neon ligts. Or to turn
- //on any other neon light, such as a sign. Original flicker code modified by Gary Granai to adjust timing.
- unsigned long starttime;
- unsigned long endtime;
- #define flickeringLED 7
- int max_count = 250; // counter for the flicker table
- int count;
- byte Flicker_table[] = { 10, 10, 20, 30, 30, 30, 40, 50, 60, 70, 80, 70, 70,
- 60, 60, 50, 50, 50, 60, 70, 80, 90, 100,
- 120, 140, 160, 240, 250, 100, 150, 250, 250, 140,
- 240, 230, 220, 100, 80, 70, 70, 70, 80, 80,
- 140, 130, 120, 110, 200, 210, 220, 220, 100, 90,
- 40, 30, 30, 30, 20, 10, 10
- };
- //**************************************************************
- void setup() {
- pinMode(flickeringLED, OUTPUT);
- }
- //************************************************************
- void loop() {
- { starttime = millis();
- endtime = starttime;
- while ((endtime - starttime)<=10000)
- flicker1();
- endtime = millis();
- }
- }
- //************************************************************
- void flicker1() {
- for ( int i = 0; i <= 80; i++) { // This for loop runs untill the flicker table finishes
- analogWrite(flickeringLED, Flicker_table[count]);
- count++;
- if (count > max_count) {
- digitalWrite(flickeringLED, HIGH);
- }
- delay(40); // the delay for our flicker, make it faster to to make it flicker a little more violently
- break;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement