Loading...
Pages: [1]   Go Down
Author Topic: "Waking up" waveform  (Read 660 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking for a waveform to drive the brightness of leds so the appearance is that the device with the leds is "waking up". I've done a lot of searching and run off on a lot of unproductive tangents. I have to think that many before me have used creative waveforms in a variety of projects. Any ideas on what to search on ?

I'm thinking of a waveform that has a steep, probably linear  rise to get to max brightness and then some sort of rolloff or decay as the brightness diminishes.

This is for a Stars wars like light saber that I have built, programmed and is complete except for this part. I would like for it to "wake up" as a prelude to the light show.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here ya go buddy. Got this from "Getting Started with Arduino" Book. Have fun! hopefully it'll help... smiley


// Copy and paste this example into an empty Arduino sketch

#define LED   9 // the pin for the LED
int i = 0;      // We’ll use this to count up and down

void setup() {
  pinMode(LED, OUTPUT); // tell Arduino LED is an output
}

void loop(){

  for (i = 0; i < 255; i++) { // loop from 0 to 254 (fade in)
    analogWrite(LED, i);      // set the LED brightness
   
    delay(10); // Wait 10ms because analogWrite
               // is instantaneous and we would
               // not see any change
  }

  for (i = 255; i > 0; i--) { // loop from 255 to 1 (fade out)

    analogWrite(LED, i); // set the LED brightness
    delay(10);           // Wait 10ms
  }

}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, but I'm way beyond that. I've looked at sine, ramp, exponential and combinations and still haven't found what I want. I have and I suspect many others as well seen what I want in Disney and other children's clips.

Thanks for the thought though.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 242
Posts: 16471
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So why not just write that in setup?
Take ebird97s code, increase the count by 10 instead of 1 so it goes up quicker, than change direction and ramp it down by increments of 1 or 2 down to whatever your pre-show level is.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Pages: [1]   Go Up
Print
 
Jump to: