Hi All,
I'm completely new on Arduino world. I'm trying to learn a little about it right now.
I'm on a Lesson that is: how to fade a LED and got this sketch:
/*
- Fade
- This example shows how to fade an LED on pin 9 using the analogWrite() function
- This example code is in the public domain.
*/
int led = 9; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 50; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
pinMode (led, OUTPUT); // declare pin 9 to be an output:
}
// the loop routine runs over and over again forever:
// put your main code here, to run repeatedly:
void loop() {
analogWrite (led, brightness); //set the brightness of pin 9:
analogWrite (fadeAmount, brightness);
brightness = brightness + fadeAmount; // change the brightness for next time through the loop:
//reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = - fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay (30);
}
So, how you can see, I changed:
int fadeAmount = 50; (initially it was 3)
And I notice the now the pins 3, 6 and 7 are HIGH, with 5v.
But when I change the fadeAmount again, for anything from 0 to 255 apart from 50, the pins are LOW again.
Is that ok? Or it is a problem?
I just was thinking that if you are working with those pins that could be a problem.
Thank you All!!!!
Be safe!