Ramp up speed of LED blink then run at constant speed

I am attempting to "ramp up" the rate of an led blink and then blink at a constant rate. similar to the fade effect using the PWM function. I am currently using an LedFlasher library as it makes my life much easier in the code. the "busslights" is the led in question.Below is the code.


// Simple Navigation & Strobe light flashing
// Author: Ostrich Longneck
// Date: 1 November 2015

// LedFlasher Library by Nick Gammon, 23 Dec 2012
//Usage:

 // LedFlasher ledName (pin, offtime, ontime, initiallyactive);   // set parameters
  
#include <LedFlasher.h>

// set up the LEDs
LedFlasher strobeLights (13, 900, 100);
LedFlasher navLights (12, 500, 1000);
LedFlasher bussLights (12, 50, 50);

void setup() 
  {      
  strobeLights.begin ();
  navLights.begin ();
  bussLights.begin ();
    }  // end of LED setup

void loop() // The main program
  {
  // update lights
  strobeLights.update ();
  navLights.update ();
  bussLights.update ();
    
  // Check for Button presses & execute code here ...eventually

 
  }  // end of loop

Hello
And the question is?

Your question lacks substance. In order to produce an effective post that will get you the help you need, you will need to quantify better what you need help with.
Currently, I think you need to know how to change the flicker rate of the LEDs.

I know how to control the blink rate of the LEDs. What I am attempting to do with 1 of the LEDs is to start at zero and slowly get to a set max. This is difficult to describe. Something like this. I know this code won’t work just giving an idea of what I am trying to do. Analogous to a car going 0-60 while slowly pushing on the gas

LedFlasher bussLights (12, 20, 20) start
LedFlasher bussLights (12, 50, 50). Next increments
LedFlasher bussLights (12, 100,50)final

The library lacks any methods to control flash rate dynamically. You would have to find another library or add those methods to the library.

Any standard methods you can think of? Adapt blink without delay?

Probably easier to modify the library as I suggested, just add methods to change the on/off times, like:

 // activate this LED
 void LedFlasher::setOnTime (unsigned long updatedTimeOn)
   {
   timeOn_ = updatedTimeOn;
   }  // end of LedFlasher::setOnTime

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.