]> git.piffa.net Git - sketchbook_andrea/blob - serial/debug_preprocessor/debug_preprocessor.ino
978b97da8a1e1d9dcf504de9297b012fb0881848
[sketchbook_andrea] / serial / debug_preprocessor / debug_preprocessor.ino
1 /*
2   Debug con macro per il preprocessore
3  
4  Blink v1
5  
6  Accensione e spegnimanto di un LED utilizzando variabili
7  per impostare la velocita' del lampeggio.
8  
9  Turns on an LED on for one second, then off for one second, repeatedly.
10  
11  This example code is in the public domain.
12  */
13
14 // Pin 13 has an LED connected on most Arduino boards.
15 // give it a name:
16 int led = 13;
17 int breve = 200;  // Variabile richiambile nel corso dell'esecuzione
18
19 #define DEBUG
20 // Debug
21 #ifdef DEBUG
22   #define DEBUG_PRINT(x)       Serial.print (x)
23   #define DEBUG_PRINTDEC(x)    Serial.print (x, DEC)
24   #define DEBUG_PRINTLN(x)     Serial.println (x)
25 #else
26   #define DEBUG_PRINT(x)
27   #define DEBUG_PRINTDEC(x)
28   #define DEBUG_PRINTLN(x) 
29 #endif 
30
31 // the setup routine runs once when you press reset:
32 void setup() {                
33   // initialize the digital pin as an output.
34   pinMode(led, OUTPUT);     
35   Serial.begin(9600);
36 }
37
38 // the loop routine runs over and over again forever:
39 void loop() {
40   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
41   DEBUG_PRINTLN("Stato HIGHT");
42   delay(breve);               // wait for a second
43   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
44   DEBUG_PRINTLN("Stato LOW");
45   delay(breve);               // wait for a second
46 }
47
48