4 * Reducing the amount of code using for(;;).
7 * (cleft) 2005 K3, Malmo University
8 * @author: David Cuartielles
9 * @hardware: David Cuartielles, Aaron Hallborg
13 - http://lab.piffa.net/schemi/8_led_single_res_bb.png
14 - http://lab.piffa.net/schemi/8_led_single_res_schem.png
17 int pinArray[8] = {2, 3, 4, 5, 6, 7, 8, 9};
22 // we make all the declarations at once
23 for (count=0;count<9;count++) {
24 pinMode(pinArray[count], OUTPUT);
29 for (count=0;count<8;count++) { // 8 e' un numero magico
30 digitalWrite(pinArray[count], HIGH);
32 digitalWrite(pinArray[count], LOW);
35 for (count=8;count>=0;count--) {
36 digitalWrite(pinArray[count], HIGH);
38 digitalWrite(pinArray[count], LOW);
45 1. Come posso fare per saltare un elemento del loop?
46 2. Come posso fare per uscire completamente dal loop?
47 3. 8 e' un numero magico: come posso evitarlo?
61 1. utilizzare continue
63 3. Utilizzare un variabile sarebbe gia' un inizio, ancora meglio estrarre il
64 valore tramite la funzione sizeof().
66 - http://www.tutorialspoint.com/cprogramming/c_continue_statement.htm
67 - https://www.arduino.cc/en/Reference/Sizeof