4 Le funzioni sono una sequenza di istruzione raggruppate appunto in un a funzione.
5 Le funzioni possono accettare argomenti e avere questi pre-impostati a valori di default se omessi.
6 Le funzioni possono limitarsi a svolgere istruzionioppure elaborare valori restituendo un risultato.
10 // Pin 13 has an LED connected on most Arduino boards.
14 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
15 delay(1000); // wait for a second
16 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
17 delay(1000); // wait for a second
21 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
22 delay(200); // wait for a second
23 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
24 delay(1000); // wait for a second
28 void varia(int a = 1000) { // Varia has a default value, the user can override it with an argument
29 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
30 delay(a); // wait for a second
31 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
32 delay(1000); // wait for a second
36 // the setup routine runs once when you press reset:
38 // initialize the digital pin as an output.
42 // the loop routine runs over and over again forever: