4 Introdotto un argomento per la funzione che nodifica l'intervallo di lampeggio
8 // constants won't change. Used here to
12 const int ledA = 13; // the number of the LED pin
14 // Variables will change:
15 int ledStateA = LOW; // ledState used to set the LED
17 long previousMillisA = 0; // will store last time LED was updated
19 // the follow variables is a long because the time, measured in miliseconds,
20 // will quickly become a bigger number than can be stored in an int.
24 int ledB = 12; //Secondo LED
25 int ledStateB = LOW; // ledState used to set the LED
26 long previousMillisB = 0; // will store last time LED was updated
31 // set the digital pin as output:
32 pinMode(ledA, OUTPUT);
33 pinMode(ledB, OUTPUT);
45 void lightLedA (int interval) {
46 // Illumina il ledA secondo un intervallo passato come argomento
48 if(millis() - previousMillisA > interval) {
49 // save the last time you blinked the LED
50 previousMillisA = millis();
52 // if the LED is off turn it on and vice-versa:
57 // set the LED with the ledState of the variable:
58 digitalWrite(ledA, ledStateA);
63 void lightLedB (int interval) {
64 // Illumina il ledB secondo un intervallo passato come argomento
66 if(millis() - previousMillisB > interval) {
67 // save the last time you blinked the LED
68 previousMillisB = millis();
70 // if the LED is off turn it on and vice-versa:
75 // set the LED with the ledState of the variable:
76 digitalWrite(ledB, ledStateB);
81 - Differenze tra fuznioni e programmazione a oggetti: integrazione tra
83 - Rapporto tra global scope e uso di pointers
84 - uso di forme di dati strutturate (array, struct) per scambiare dati tra funzioni e programma