Pages: [1]   Go Down
Author Topic: help on time library .unkown commands  (Read 328 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what is the meaning of those commands  in SerialTime example ?
Code:
#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)
Logged

East Anglia (UK)
Online Online
Faraday Member
**
Karma: 118
Posts: 4334
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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
« Last Edit: February 11, 2013, 11:10:04 am by UKHeliBob » Logged

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

California
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3438
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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:
Serial.print(TIME_REQUEST);

becomes

Code:
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.
« Last Edit: February 11, 2013, 11:08:44 am by Arrch » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you for your answers . they were enlinghtening
Logged

Pages: [1]   Go Up
Jump to: