LER DATA E HORA NO ARDUINO . Erro no código

Olá a todos.
Estou a desenvolver um projeto de licenciatura e gostaria de gravar para um bloco de notas segundo esta forma:
2013/07/16 18:50:00 3.00V,

(no qual, estou a ler tensão [3V] de um circuito, pela porta analogica A0).

Irei gravar para bloco de notas no Processing, mas neste momento tenho um erro no código do Arduino. Gostaria de ler a Data e Hora no Arduino, mas não estou a conseguir!!

De seguida irei apresentar o código, no qual já inclui as livrarias encontradas no site do Arduino, a DataTime.h e a DateTimeStrings.h.

#include <DateTime.h>
#include <DateTimeStrings.h>

#define TIME_MSG_LEN  11   // time sync to PC is HEADER and unix time_t as ten ascii digits
#define TIME_HEADER  255   // Header tag for serial time sync message


int PinAnalogA0 = 0; 
float valAnalog=0;  // Coloca o Pino A0 a 0
float temp = 0;

void setup()
{
  Serial.begin(9600);
  
   getPCtime();   // try to get time sync from pc        
  if(DateTime.available()) 
  { // update clocks if time has been synced
    unsigned long prevtime = DateTime.now();
    while( prevtime == DateTime.now() )  // wait for the second to rollover
      ;
    DateTime.available(); //refresh the Date and time properties
    digitalClockDisplay( );   // update digital clock

    // send our time to an app listening on the serial port
    Serial.write( TIME_HEADER, BYTE); // this is the header for the current time
    Serial.println(DateTime.now());      
  }  
}


void getPCtime()
 {  // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){  
        char c= Serial.read();          
        if( c >= '0' && c <= '9')  
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }  
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

void getPCtime()
 {   // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){  
        char c= Serial.read();          
        if( c >= '0' && c <= '9')  
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }  
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

void loop ()
{
    valAnalog = analogRead(PinAnalogA0);
    temp = (valAnalog * 5.0) /1024;
    
    Serial.print("  Tensao= " );
    Serial.print(temp);

    delay(2000);
}

O erro que me aparece é o seguinte:

'DateTime', was not declared in this scope

Agradeço a quem me poder de imediato ajudar e dar informações sobre como resolver este erro!!!

Obrigado.

Um abraço,

Pedro Santos

Estou a usar a versão 1.0.1 do Arduino.. Vi também que existe a libraria #include <Time.h>,
alguém me poder dizer se isso tem influência no erro obtido?
Adicionei a libraria #include <Time.h> às outras duas e continua a dar o mesmo Erro!! :frowning:

PedroS23:
Olá a todos.
Estou a desenvolver um projeto de licenciatura e gostaria de gravar para um bloco de notas segundo esta forma:
2013/07/16 18:50:00 3.00V,

(no qual, estou a ler tensão [3V] de um circuito, pela porta analogica A0).

Irei gravar para bloco de notas no Processing, mas neste momento tenho um erro no código do Arduino. Gostaria de ler a Data e Hora no Arduino, mas não estou a conseguir!!

De seguida irei apresentar o código, no qual já inclui as livrarias encontradas no site do Arduino, a DataTime.h e a DateTimeStrings.h.

#include <DateTime.h>

#include <DateTimeStrings.h>

#define TIME_MSG_LEN  11   // time sync to PC is HEADER and unix time_t as ten ascii digits
#define TIME_HEADER  255   // Header tag for serial time sync message

int PinAnalogA0 = 0;
float valAnalog=0;  // Coloca o Pino A0 a 0
float temp = 0;

void setup()
{
  Serial.begin(9600);
 
   getPCtime();   // try to get time sync from pc       
  if(DateTime.available())
  { // update clocks if time has been synced
    unsigned long prevtime = DateTime.now();
    while( prevtime == DateTime.now() )  // wait for the second to rollover
      ;
    DateTime.available(); //refresh the Date and time properties
    digitalClockDisplay( );   // update digital clock

// send our time to an app listening on the serial port
    Serial.write( TIME_HEADER, BYTE); // this is the header for the current time
    Serial.println(DateTime.now());     
  } 
}

void getPCtime()
{  // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {       
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){ 
        char c= Serial.read();         
        if( c >= '0' && c <= '9') 
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number           
      } 
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    } 
  }
}

void getPCtime()
{   // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {       
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){ 
        char c= Serial.read();         
        if( c >= '0' && c <= '9') 
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number           
      } 
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    } 
  }
}

void loop ()
{
    valAnalog = analogRead(PinAnalogA0);
    temp = (valAnalog * 5.0) /1024;
   
    Serial.print("  Tensao= " );
    Serial.print(temp);

delay(2000);
}




O erro que me aparece é o seguinte:

**[u]'DateTime', was not declared in this scope[/u]**

Agradeço a quem me poder de imediato ajudar e dar informações sobre como resolver este erro!!!


Obrigado.

Um abraço,

**Pedro Santos**

Acho que você não copiou a livraria para a pasta "libraries" do arduino. Arduino Playground - HomePage

Mortis:
Acho que você não copiou a livraria para a pasta "libraries" do arduino. Arduino Playground - HomePage

Muito Obrigado Mortis, por me teres respondido.
Eu neste momento não me encontro junto do computador no qual estou a trabalhar, mas amanhã vou fazer isso mesmo que sugeriu!!
Basta copiar o ficheiro Time.c para a livraria do Arduino certo??

Obrigado pela atenção!!

Abraço

Tens de descompactar o zip para C:/.... arduino-1.0.3\libraries
Dentro desta pasta libraries verás que já la existem outras pastas de outras libs.
Normalmente a lib vem acompanhada com exemplos que para teres a certeza que colocaste a lib no local correcto passaras a encontrar uma nova entrada nos exemplos da IDE para essa lib.
Após colocares la a lib na pasta é necessário reiniciares a IDE para que ela possa ser reconhecida.

exemplo.png

Pedro,

Adicionando à resposta do Hugo, dentro do arquivo zip existem 3 pastas ("DS1307RTC", "Time" que é a que você esta referenciando e "TimeAlarms"), cada uma delas é uma livraria. Você poderia copiar só a pasta time, mas você pode copiar todas e ver o que fazem as outras :wink:

veja que já existe uma pasta chamada libraries:
"pasta onde esta o arduino"\arduino\libraries
você copia a pasta Time para o caminho acima que passa a ter a seguinte estrutura:

"pasta onde esta o arduino"\arduino\libraries\Time
"pasta onde esta o arduino"\arduino\libraries\Time\Examples
"pasta onde esta o arduino"\arduino\libraries\Time\DateStrings.cpp
"pasta onde esta o arduino"\arduino\libraries\Time\keywords.txt
"pasta onde esta o arduino"\arduino\libraries\Time\Readme.txt
"pasta onde esta o arduino"\arduino\libraries\Time\Time.cpp
"pasta onde esta o arduino"\arduino\libraries\Time\Time.h

dentro da pasta Examples estarão os exemplos que o HugoPT falou :wink:

Se não quiser colocar na pasta do arduino, você pode colocar na pasta documentos\arduino\libraries. conforme é explicado neste link http://arduino.cc/en/Guide/Libraries

Conta-nos se deu tudo certo!

PedroS23:
Estou a desenvolver um projeto de licenciatura e gostaria de gravar para um bloco de notas segundo esta forma:

Desculpa a questão mais ou menos pessoal, mas é uma licenciatura de quê?
Esperas obter uma boa nota apresentando código tirado da net?

Isto...

void getPCtime()
 {  // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){  
        char c= Serial.read();          
        if( c >= '0' && c <= '9')  
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }  
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

void getPCtime()
 {   // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){  
        char c= Serial.read();          
        if( c >= '0' && c <= '9')  
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }  
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

Tens a mesma função escrita duas vezes. Apaga uma delas.

Já o fiz, aparece:
"Error compiling"

Não podes verificar se te mandar o codigo por email?

Não.

Repara na minha assinatura...

Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).

Se quiseres, mete o código aqui no fórum e eu vejo qual é o erro.

Abraço.

Já o fiz, aparece:
"Error compiling"

Não podes verificar se te mandar o codigo por email?

Ola Pedro.
Me parece que estas a tentar fazer o teu projeto em cima do joelho.Desculpa a frontalidade mas penso que para obteres ajuda deves primeiro saber o que estas a fazer e qual o caminho que deves seguir para o alcançares.Digo isto porque como o Bubulindo te respondeu e bem nos só cá estamos a apoiar e não fazer por ti.
Se para ti o Arduino e novo e queres fazer um projeto com ele já o devias ter começado a estudar a um tempo.

Já o fiz, aparece:
"Error compiling"

Bom tenho a bola de cristal avariada e só com isso não da para ajudar.
Tens de dar mais informação do erro ...

Nao leves o meu comentario pelo lado mau, mas imagina que na tua apresentação o teu orientador te faz esta questão
O que e void getPCtime() e como funciona
Saberias responder neste momento.
Se não apenas te estas a enganar a ti próprio e deves ir passar um pouco os olhos em C.

aparece-me erro na função void getPCtime() : "redefinition of void getPCtime()

Este erro e claro como a agua "redefinicao da função getPCtime" Trocado por palavras miudas função definida duas vezes e tal não e permitido

Eu já vi o erro... e é a prova provada que tu estás a copiar descaradamente do site do Arduino (e mal...) sem saberes o que estás a fazer nem sequer te dares ao trabalho de entender.

Obrigado pela sugestão.
Envio em seguida o código:

Separador 1: Main

#include <DateTime.h>
#include <DateTimeStrings.h>
#include <Time.h>

#define TIME_MSG_LEN  11   // time sync to PC is HEADER and unix time_t as ten ascii digits
#define TIME_HEADER  255   // Header tag for serial time sync message


int PinAnalogA0 = 0; 
float valAnalog=0;  // Coloca o Pino A0 a 0
float temp = 0;

void setup()
{
  Serial.begin(9600);
  
   getPCtime();   // try to get time sync from pc  
   
  if(DateTime.available()) 
  { // update clocks if time has been synced
    unsigned long prevtime = DateTime.now();
    while( prevtime == DateTime.now() )  // wait for the second to rollover
      ;
    DateTime.available(); //refresh the Date and time properties
    digitalClockDisplay( );   // update digital clock

    // send our time to an app listening on the serial port
    Serial.println( TIME_HEADER, 13); // this is the header for the current time
    Serial.println(DateTime.now());      
  }  
}


void getPCtime()
 {  // if time available from serial port, sync the DateTime library
   while(Serial.available() >=  TIME_MSG_LEN ){  // time message
    if( Serial.read() == TIME_HEADER ) {        
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){  
        char c= Serial.read();          
        if( c >= '0' && c <= '9')  
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number            
      }  
      DateTime.sync(pctime);   // Sync DateTime clock to the time received on the serial port
    }  
  }
}

void digitalClockDisplay(){
  // digital clock display of current time   
}

void loop ()
{
    valAnalog = analogRead(PinAnalogA0);
    temp = (valAnalog * 5.0) /1024;
    
    Serial.print("  Tensao= " );
    Serial.print(temp);

    delay(2000);
}

Separador 2 : DateTime.h

/*
  DateTime.h - Arduino library for date and time functions
  Copyright (c) Michael Margolis.  All right reserved.


  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
*/

#define DateTime_h
#include <time.h>
#include <Arduino.h>
#include <inttypes.h>
//#include <wiring.h> // next two typedefs replace <wiring.h> here (fixed for rel 0012)
typedef uint8_t byte;  
typedef uint8_t boolean;

typedef unsigned long time_t;

/*==============================================================================*/
/* Useful Constants */
#define SECS_PER_MIN  (60UL)
#define SECS_PER_HOUR (3600UL)
#define SECS_PER_DAY  (SECS_PER_HOUR * 24L)
#define DAYS_PER_WEEK (7L)
#define SECS_PER_WEEK (SECS_PER_DAY * DAYS_PER_WEEK)
#define SECS_PER_YEAR (SECS_PER_WEEK * 52L)
#define SECS_YR_2000  (946681200UL)
 
/* Useful Macros for getting elapsed time */
#define numberOfSeconds(_time_) (_time_ % SECS_PER_MIN)  
#define numberOfMinutes(_time_) ((_time_ / SECS_PER_MIN) % SECS_PER_MIN) 
#define numberOfHours(_time_) (( _time_% SECS_PER_DAY) / SECS_PER_HOUR)
#define dayOfWeek(_time_)  (( _time_ / SECS_PER_DAY + 4)  % DAYS_PER_WEEK) // 0 = Sunday
#define elapsedDays(_time_) ( _time_ / SECS_PER_DAY)  // this is number of days since Jan 1 1970
#define elapsedSecsToday(_time_)  (_time_ % SECS_PER_DAY)   // the number of seconds since last midnight 
#define previousMidnight(_time_) (( _time_ / SECS_PER_DAY) * SECS_PER_DAY)  // time at the start of the given day
#define nextMidnight(_time_) ( previousMidnight(_time_)  + SECS_PER_DAY ) // time at the end of the given day 
#define elapsedSecsThisWeek(_time_)  (elapsedSecsToday(_time_) +  (dayOfWeek(_time_) * SECS_PER_DAY) )   

// todo add date math macros
/*============================================================================*/

typedef enum {
	  dtSunday, dtMonday, dtTuesday, dtWednesday, dtThursday, dtFriday, dtSaturday
} dtDays_t;

typedef enum {dtStatusNotSet, dtStatusSet, dtStatusSync
}  dtStatus_t ;

class DateTimeClass
{
private:
	time_t sysTime;  // this is the internal time counter as seconds since midnight Jan 1 1970 (aka unix time)  
	unsigned long prevMillis;
	void setTime(time_t time);
public:
	DateTimeClass();
	void sync(time_t time); // set internal time to the given value 
	time_t now(); // return the current time as seconds since Jan1 1970
	boolean available();  // returns false if not set, else refreshes the Date and Time properties and returns true
	dtStatus_t status;
	byte Hour;
	byte Minute;
	byte Second;
	byte Day;
	byte DayofWeek; // Sunday is day 0 
	byte Month; // Jan is month 0
	byte Year;  // the Year minus 1900 
	
	// functions to convert to and from time components (hrs, secs, days, years etc) to time_t  
	void localTime(time_t *timep,byte *psec,byte *pmin,byte *phour,byte *pday,byte *pwday,byte *pmonth,byte *pyear); // extracts time components from time_t
	time_t makeTime(byte sec, byte min, byte hour, byte day, byte month, int year ); // returns time_t from components
};

extern DateTimeClass DateTime;  // make an instance for the user


#endif /* DateTime_h */

Separador 3 - DateTimeString.h

/*
  DateTimeStrings.h - Arduino library for day and month strings
  Copyright (c) Michael Margolis.  All right reserved.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
*/

#define DateTimeStrings_h

#include <inttypes.h>
#include <DateTime.h> 

#define dt_MAX_STRING_LEN 9 // length of longest string (excluding terminating null)

class DateTimeStringsClass
{
private:
	char buffer[dt_MAX_STRING_LEN+1];
public:
	DateTimeStringsClass();
	char* monthStr(byte month);
	char* dayStr(byte day);
};

extern DateTimeStringsClass DateTimeStrings;  // make an instance for the user

#endif /* DateTimeString_h */

Olá Pessoal.

Agora posso dizer k já tenho novidades!!

Abri o seguinte exemplo retirado da biblioteca time:

/* 
 * TimeSerial.pde
 * example code illustrating Time library set through serial port messages.
 *
 * Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970)
 * you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013
 T1357041600  
 *
 * A Processing example sketch to automatically send the messages is inclided in the download
 * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
 */ 
 
#include <Time.h>  

#define TIME_HEADER  "T"   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message 

void setup()  {
  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  pinMode(13, OUTPUT);
  setSyncProvider( requestSync);  //set function to call when sync required
 // Serial.println("Waiting for sync message");
}






void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}


void processSyncMessage() {
  unsigned long pctime;
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013

  if(Serial.find(TIME_HEADER)) {
     pctime = Serial.parseInt();
     if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013)
       setTime(pctime); // Sync Arduino clock to the time received on the serial port
     }
  }
}

time_t requestSync()
{
  Serial.write(TIME_REQUEST);  
  return 0; // the time will be sent later in response to serial mesg
}

void loop(){    
  if (Serial.available()) {
    processSyncMessage();
  }
  if (timeStatus()!= timeNotSet) {
    digitalClockDisplay();  
  }
  if (timeStatus() == timeSet) {
    digitalWrite(13, HIGH); // LED on if synced
  } else {
    digitalWrite(13, LOW);  // LED off if needs refresh
  }
  delay(1000);
  

  time_t t = now(); // Store the current time in time
                    //  variable t
                    
  hour(t);          // Returns the hour for the given
                    //  time t
  minute(t);        // Returns the minute for the given
                    //  time t
  second(t);        // Returns the second for the given
                    //  time t
  day(t);           // The day for the given time t

  weekday(t);       // Day of the week for the given
                    //  time t  
  month(t);         // The month for the given time t

  year(t);          // The year for the given time t
  
  

  Serial.print(year(t));
  Serial.print("/");
  Serial.print(month(t));
  Serial.print("/");
  Serial.print(day(t)); 
  Serial.print(" "); 

  Serial.print(hour(t));
  printDigits(minute(t));
  printDigits(second(t));
  Serial.println(""); 
}

Retirei o time_t t = now(); do site onde fiz o download da biblioteca time.
De momento aparece-me no Serial Monitor desta forma: 1970/1/1 00:00:00 e como tenho o delay(1000) ele vai somando 1 segundo ao formato da hora aí.
Tenho no separador a classe time.h.

Alguem me sabe dizer como colocado a Data e Hora conetada com a do PC e para aparecer a atual?
Ou acham que depois de mandar gravar pelo Processing ele atualiza para a hora e data normal???

Obrigado a Todos!!!

Se não tens um digitalClockDisplay porque é que não apagas a chamada à função em vez de criar uma função fantasma?

Isto é o erro que te dá...

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard -I/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime -I/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTimeStrings -I/Users/bubulindo/Documents/Arduino/libraries/Time /var/folders/b2/b2Qxxb0JHpulgWmJOPT3vU+++TI/-Tmp-/build3264005724631118976.tmp/sketch_jul17a.cpp -o /var/folders/b2/b2Qxxb0JHpulgWmJOPT3vU+++TI/-Tmp-/build3264005724631118976.tmp/sketch_jul17a.cpp.o
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:52:1: warning: "SECS_PER_DAY" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:25:1: warning: this is the location of the previous definition
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:53:1: warning: "DAYS_PER_WEEK" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:26:1: warning: this is the location of the previous definition
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:55:1: warning: "SECS_PER_YEAR" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:28:1: warning: this is the location of the previous definition
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:56:1: warning: "SECS_YR_2000" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:29:1: warning: this is the location of the previous definition
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:62:1: warning: "dayOfWeek" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:35:1: warning: this is the location of the previous definition
In file included from sketch_jul17a.ino:3:
/Users/bubulindo/Documents/Arduino/libraries/Time/Time.h:69:1: warning: "elapsedSecsThisWeek" redefined
In file included from sketch_jul17a.ino:1:
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.h:40:1: warning: this is the location of the previous definition
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard -I/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime -I/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTimeStrings -I/Users/bubulindo/Documents/Arduino/libraries/Time -I/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/utility /Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp -o /var/folders/b2/b2Qxxb0JHpulgWmJOPT3vU+++TI/-Tmp-/build3264005724631118976.tmp/DateTime/DateTime.cpp.o
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp:15:20: warning: wiring.h: No such file or directory
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp: In member function 'void DateTimeClass::setTime(time_t)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp:28: error: 'millis' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp: In member function 'time_t DateTimeClass::now()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/DateTime/DateTime.cpp:43: error: 'millis' was not declared in this scope

E o sítio de onde tiraste esta biblioteca diz:

This library has been superseded by a newer version that is available here

Se não estivesses a fazer isto à pressa, terias feito download da outra biblioteca. Terias apagado a que tens actualmente e tudo bateria certo. Assim tens uma biblioteca que não funciona com a versão da IDE que tens no teu computador.

Eu fui à página: Arduino Playground - Time
e fiz o download da biblioteca time e da Ethernet e String, pois dizia o seguinte:
To use all of the features in the library, you'll need the UDPbitewise library, found here. E fiz o download das duas livrarias anteriores.

Neste momento tenho as seguintes livrarias:

Uploaded with ImageShack.us

Pelo que me apercebo então, a livraria DateTime está desatualizada e tenho duvidas em relação à DatatimeStrings.

Depois disto, correndo o ficheiro time.h, devia conseguir ler Data e tempo no ecrã correto???

Tu não estavas a usar a DateTimeStrings...

Sim.

Olá Pessoal.

Agora posso dizer k já tenho novidades!!

Abri o seguinte exemplo retirado da biblioteca time:

/* 
 * TimeSerial.pde
 * example code illustrating Time library set through serial port messages.
 *
 * Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970)
 * you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013
 T1357041600  
 *
 * A Processing example sketch to automatically send the messages is inclided in the download
 * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
 */ 
 
#include <Time.h>  

#define TIME_HEADER  "T"   // Header tag for serial time sync message
#define TIME_REQUEST  7    // ASCII bell character requests a time sync message 

void setup()  {
  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  pinMode(13, OUTPUT);
  setSyncProvider( requestSync);  //set function to call when sync required
 // Serial.println("Waiting for sync message");
}






void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}


void processSyncMessage() {
  unsigned long pctime;
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013

  if(Serial.find(TIME_HEADER)) {
     pctime = Serial.parseInt();
     if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013)
       setTime(pctime); // Sync Arduino clock to the time received on the serial port
     }
  }
}

time_t requestSync()
{
  Serial.write(TIME_REQUEST);  
  return 0; // the time will be sent later in response to serial mesg
}

void loop(){    
  if (Serial.available()) {
    processSyncMessage();
  }
  if (timeStatus()!= timeNotSet) {
    digitalClockDisplay();  
  }
  if (timeStatus() == timeSet) {
    digitalWrite(13, HIGH); // LED on if synced
  } else {
    digitalWrite(13, LOW);  // LED off if needs refresh
  }
  delay(1000);
  

  time_t t = now(); // Store the current time in time
                    //  variable t
                    
  hour(t);          // Returns the hour for the given
                    //  time t
  minute(t);        // Returns the minute for the given
                    //  time t
  second(t);        // Returns the second for the given
                    //  time t
  day(t);           // The day for the given time t

  weekday(t);       // Day of the week for the given
                    //  time t  
  month(t);         // The month for the given time t

  year(t);          // The year for the given time t
  
  

  Serial.print(year(t));
  Serial.print("/");
  Serial.print(month(t));
  Serial.print("/");
  Serial.print(day(t)); 
  Serial.print(" "); 

  Serial.print(hour(t));
  printDigits(minute(t));
  printDigits(second(t));
  Serial.println(""); 
}

Retirei o time_t t = now(); do site onde fiz o download da biblioteca time.
De momento aparece-me no Serial Monitor desta forma: 1970/1/1 00:00:00 e como tenho o delay(1000) ele vai somando 1 segundo ao formato da hora aí.
Tenho no separador a classe time.h.

Alguem me sabe dizer como colocado a Data e Hora conetada com a do PC e para aparecer a atual?
Ou acham que depois de mandar gravar pelo Processing ele atualiza para a hora e data normal???
Os ciclos if já implementados para ativar as saídas do pin13 podem ser desativadas correto?

Obrigado a Todos!!!

Explica melhor a primeira pergunta.

Não sei o que é Processing.

Sim.