LarryD:
This may help you:
/*
Blink
Turns on an LED on for 1/2 a second, then off for 1/2 a second, repeatedly.
*/
//***************************************************************
//If you comment the line: #define DEBUG
//the DPRINT & DPRINTLN lines are defined as blank, thus would be ignored by the compiler
#define DEBUG // if this line is NOT commented, these macros will be included in the sketch
//examples:
// DPRINTLN("Testing123");
// DPRINTLN(0xC0FFEEul,DEC);
// DPRINTLN(12648430ul,HEX);
// DPRINTLNF("This message came from your flash");
#ifdef DEBUG
#define DPRINT(...) Serial.print(VA_ARGS)
//OR, #define DPRINT(args...) Serial.print(args)
#define DPRINTLN(...) Serial.println(VA_ARGS)
#define DRINTF(...) Serial.print(F(VA_ARGS))
#define DPRINTLNF(...) Serial.println(F(VA_ARGS)) //printing text using the F macro
#else
#define DPRINT(...) //blank line
#define DPRINTLN(...) //blank line
#define DPRINTF(...) //blank line
#define DPRINTLNF(...) //blank line
#endif
//***************************************************************
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int z = 123;
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for 1/2 a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for 1/2 a second
//the following 6 lines of code will be expanded only if the word "DEBUG" is defined
//if "DEBUG" is not defined, the following 6 lines are ignored
DPRINTLN("Testing123");
DPRINTLN(0xC0FFEEul,DEC); // print a hex number in decimal
DPRINTLN(12648430ul,HEX); // print a decimal number in hex
DPRINTLNF("This message came from your flash "); // this text is from your flash thus saving ram
DPRINTLN( z ); // print the value of z
DPRINTLN(); // print a blank line
}
Ok this is virtually repeat post of your earlier post.
When I read the earlier post I could not really follow it.
Now it is starting to make a bit of sense to me, but I have some pretty dumb questions...
What is the significance of the following if any:
- "..." in this : #define DPRINT(...)
- "args..." in this : #define DPRINT(args...)
- "VA_ARGS" in this : Serial.print(VA_ARGS)
Is it a standard format?