fade on then sty on

hi iam new to Arduino.

I have got my my Arduino to blink fade. but I would like to fade slowly on then stay on.

i would be grateful if someo ne could help me getting the code for this. i haave searched all over the net and forums. and havent found any info regarding this.

thanks in adavance for any help given

This isn't a free code writing service. Show your best effort and we can help you learn what you did wrong, or go to the Gigs and Collaborations sections and offer to pay someone to write it for you.

hi then code I have managed to do is:

int value ;
int ledpin = 9; // light connected to digital pin 9
long time=0;

int periode = 20000;
int displace = 0;

void setup()

void loop()
static boolean already_done = false;
if (!already_done)
time = millis();
value = 128+127cos(2PI/periode*(displace-time));
analogWrite(ledpin, 255-value); // sets the value (range from 0 to 255)
already_done = (value <= 1);

its roughly what I want but I wanted to see if I can get it to glow start up then dim then start up then stay on. thanks

Go on. It is not Rocket Science.

const int ledpin = 9;

void setup(void)
    byte val;
    pinMode(ledpin, OUTPUT);
    pinMode(8, OUTPUT);
    for (val = 0; val < 255; val++) {
        analogWrite(ledpin, val);
    for (val = 255; val > 0; --val) {
        analogWrite(ledpin, val);
    for (val = 0; val < 255; val++) {
        analogWrite(ledpin, val);

void loop(void)




ha ha
for me it is as I am learning the codes.

thanks for your help

i wanted a glow up without delay and blink then stay on.. like what I had before but without delay.
I am planning to use a sd card.

both start at the same time

last question I have prewired 5v leds.. how many can I put on one pin..as I am having trouble making a code with more than one same kind of code

thanks again for your help :slight_smile:

Is the shift key on your keyboard broken? if you really want good help, try to look like you care a little and are willing to put in at least a modicum of effort. If you can't even write half-ass right normal things then most folks are going to assume you could never handle code. The compiler is far more strict about grammar than even the meanest old English teacher.

Not trying to not-pick. Just trying to help you get help and not look dumb.

SD card for what? What do you mean pre-wired? No such thing as a 5V LED. Maybe you mean LEDs that you paid too much for with resistors already soldered. You can only do 1 per pin, if that's the case. What are your motivations for not using delay? Have you put any effort into learning how to use millis? What do you mean 'both start at the same time'?

Help you get is only going to be as good as the detail you give and the effort you put into helping yourself.

I mean pre wired 5 volts leds.
And no I didn’t pay to much.

I was asking how many leds, can put on one
Pin. As I can not work out how to program 2 pins on one program.

It was only a query.

And regarding what I was asking before.
Was I wanted to make the led fade on then blink then stay on.

I am half way there.

As I can not work out how to program 2 pins on one program.

The same way you do for one pin. You just write a line of code to analogWrite to that pin number instead.

Oh ok.
Will try that out.
Thanks for your help