I've been trying to create a timestamp for a project, but i'm lacking a library (DateTime), I've inserted the library in the arduino/libraries directory, its on the sketch/import libraries/contributed/ tab, but still doesn't work into the actual sketch.
Hi DolphinDev
Please post your program using code tags (the </> button on the toolbar).
And also copy and paste the error messages you get when you try to compile the program.
Regards
Ray
This is my current code:
#include <Wire.h>
/**
(c) I do not own this code, it is public and I wish to edit for educational purposes.
*/
//NOTE I removed the Lib i was trying to use.
(with lib)
#include <DateTime.h>
int tmp102Address = 0x48;
void setup(){
Serial.begin(9600);
Wire.begin();
}
void loop(){
float celsius = getTemperature();
Serial.print("Celsius: ");
Serial.println(celsius);
float fahrenheit = (1.8 * celsius) + 32;
Serial.print("Fahrenheit: ");
Serial.println(fahrenheit);
Serial.println("=======");
delay(30000);
}
float getTemperature(){
Wire.requestFrom(tmp102Address,2);
byte MSB = Wire.read();
byte LSB = Wire.read();
int TemperatureSum = ((MSB << 8) | LSB) >> 4;
float celsius = TemperatureSum*0.0625;
return celsius;
}
ERROR:
/Users//Documents/Arduino/libraries/DateTime/DateTime.cpp: In member function 'void DateTimeClass::setTime(time_t)':
/Users//Documents/Arduino/libraries/DateTime/DateTime.cpp:28: error: 'millis' was not declared in this scope
/Users/Documents/Arduino/libraries/DateTime/DateTime.cpp: In member function 'time_t DateTimeClass::now()':
/Users/j/Documents/Arduino/libraries/DateTime/DateTime.cpp:43: error: 'millis' was not declared in this scope
NOTE:
I am aware of the error; But do not know how to resolve it
MODEL: Arduino Uno (by the way)
Is this the library you are using? Arduino Playground - DateTime
There is a note on that page that says it has been superseded and recommending this instead: Arduino Playground - Time
Thank you!