Go Down

Topic: help on time library .unkown commands (Read 390 times) previous topic - next topic

dalai

what is the meaning of those commands  in SerialTime example ?
Code: [Select]
#define TIME_MSG_LEN  11   // time sync to PC is HEADER followed by unix time_t as ten ascii digits
#define TIME_HEADER  'T'   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message
.....
time_t requestSync()
{
  Serial.print(TIME_REQUEST); 
return 0; // the time will be sent later in response to serial mesg

Where can I read about those commands ?
I google them  and  only the SerialTime example came up
I read  time  filefolder  and I can't find anithing about those commands (with capital letters like:TIME_MSG_LEN)

UKHeliBob

#1
Feb 11, 2013, 05:05 pm Last Edit: Feb 11, 2013, 05:10 pm by UKHeliBob Reason: 1
Code: [Select]
#define SOMETEXT SOMETHINGELSE
will cause in the compiler to replace SOMETEXT with SOMETHINGELSE whenever it comes across it in your code.  This allows you to use meaningful names and also for you to be able to change the meaning of SOMETHING in one place rather than searching through you code.

Google #define
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Arrch

#2
Feb 11, 2013, 05:06 pm Last Edit: Feb 11, 2013, 05:08 pm by Arrch Reason: 1
Code: [Select]
#define TIME_REQUEST  7

Tells the preprocessor to look for TIME_REQUEST anywhere in the code and replace it with 7. So the line

Code: [Select]
Serial.print(TIME_REQUEST);

becomes

Code: [Select]
Serial.print(7);

before it is compiled. If you're asking for what those specific TIME_ values mean, then the comments right next to them should tell you.

dalai

thank you for your answers . they were enlinghtening

Go Up