modulation with millis

i´m trying to do blink at some start time and end time, with modulation, with out delay

but i´m not figure out how!!!

does any one know a good tut for this?

tks

Are you saying you need to vary the on and off times?
Just use the blink without delay example, and assign a different value to "interval" when you change the LED state.

AWOL i saw already that.. but i was looking for this..

http://www.thecustomgeek.com/files/Sleep_LED.pde

but remove the delays for millis..

:1

But that uses "for" loops (which you can't use in the blink without delay example) and "delay" (which you can't use in the blink without delay example).
So, look at the blink without delay example, and use "analogWrite" instead of "digitalWrite", and keep a running count of how bright your LED should be. Make the count either global or static.

tks for quick reply

but by changing the digital by analog don´t work...

maybe if try some array, can make that increase and delay?

int arrray2[] = {  0,0,1,1,1,2 2,2,2,2,3,4,5,6,7,8,9,10,11}; //storage

?
kr

but by changing the digital by analog don´t work..

Trust me, it does.
Yes, I'd use an array, or a trig function to set the level, depending on how much spare processing time I had.

I trust but can´t blink it grrrrrr

const int ledPin =  13;

// Variables will change:
long previousMillis = 0;

long interval = 1000;

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{
  // commands for continuous blush
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   // save the last time you blinked the LED 

    if (analogRead (ledPin) == 0) 
        analogWrite(ledPin, 255);  
    else          
      analogWrite(ledPin, 0);
  }

  analogWrite(ledPin, 0);

}

What i´m missing :! ? tks for your help

Pin 13?
PWM?

is morning here :slight_smile: shame on me

either didn´t work.. on pin5

will dig more... tks anyway AWOL

    if (analogRead (ledPin) == 0) 
        analogWrite(ledPin, 255);  
    else          
      analogWrite(ledPin, 0);

The analogRead() function only works on the analog pins. The analogWrite() function only works on some digital pins. There is no way you can use both functions on the same pin in any kind of meaningful way.