4 This example shows how to fade an LED on pin 9
5 using the analogWrite() function.
6 This example code is in the public domain.
7 From Arduino for dummies.
10 const int led = 9; // LED con PWM
11 byte brightness = 0; // Luminosita'
12 int fadeAmount = 5; // Step di modifica luminosita'
13 const int pause = 30; // Pausa tra incrementi
17 pinMode(led, OUTPUT); // declare pin 9 to be an output:
22 analogWrite(led, brightness);
23 brightness = brightness + fadeAmount;
25 if (brightness == 0 || brightness == 255) {
26 // Invertire incremento ai valori limiti
27 fadeAmount = -fadeAmount ;
29 // wait for 30 milliseconds to see the dimming effect
35 1. Che rapporto c'e' tra un OR e due cicli IF ?
36 2. E tra un AND e due cicli IF ?
58 1. Due cicli IF sequenziali con:
62 2. Due cicli IF annidiati che verificano due condizioni in sucessione