Hi,
I am trying to dim on and off LED strip and loop it for my art project. I am very new to Arduino and hope to use it to achieve the effect that I have in mind.
I found this tutorial that is very close to what I would like to do. I manage to use it for my single color LED stripe. Yet, I have no idea how to make it loop. I know it is a very amateur question but I don't know where else I could go for help...
It would be very appreciated if someone can help me with this.
Thank you very much in advance.
The tutorial I found.
The script I modified.
===
#define GREEN_LED 9
//overall brightness value
int brightness = 255;
//individual brightness values for the red, green and blue LEDs
int gBright = 0;
int fadeSpeed = 5;
void setup() {
//set up pins to output.
pinMode(GREEN_LED, OUTPUT);
//Call the TurnOn method, wait, then call TurnOff
TurnOn();
delay(500);
TurnOff();
}
void TurnOn(){
for (int i=0;i<256; i++){
analogWrite(GREEN_LED, gBright);
gBright +=1;
delay(fadeSpeed);
}
}
void TurnOff(){
for (int i=0;i<256; i++){
analogWrite(GREEN_LED, brightness);
brightness -= 1;
delay(fadeSpeed);
}
}
void loop(){
}