Amigos,
estou tentando usar as funções da biblioteca Time.h mas não consigo.
Já baixei a biblioteca, coloquei na pasta "libraries",
Quando executo o código, por exemplo, só pra testar a função :
#include <Time.h>
void setup() {
Serial.begin(9600);
}
void loop(){
digitalClockDisplay();
}
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();
}
Aparece os erros:
sketch_mar10a.ino: In function ‘void digitalClockDisplay()’:
sketch_mar10a:16: error: ‘hour’ was not declared in this scope
sketch_mar10a:17: error: ‘minute’ was not declared in this scope
sketch_mar10a:17: error: ‘printDigits’ was not declared in this scope
sketch_mar10a:18: error: ‘second’ was not declared in this scope
sketch_mar10a:20: error: ‘day’ was not declared in this scope
sketch_mar10a:22: error: ‘month’ was not declared in this scope
sketch_mar10a:24: error: ‘year’ was not declared in this scope
ou seja, não está enxergando nenhuma função de Time.h
Estou no LINUX UBUNTU ...
Tags:
Provavelmente ele não está achando a lib Time.h. Veja se ela está instalada no diretório libraries do Arduino, dentro de um diretório chamado Time.
Vc tem também que acrescentar a função printDigits ao seu código, já que ela não vem na lib Time:
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);
}
Coloquei essa função dentro do seu fonte e funcionou aqui.
Mauro, era algum problema de permissão do Linux - eu uso o Arduino no Ubuntu 12.04, testei noutro PC com Linux tb e deu certo. A pasta Time.h estava sim copiada no lugar correto. Mesmo assim valeu mano! :-)
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por