I'm looking for a way to store real time date and time from took from my laptop to the Arduino R3 EEPROM like ctime in C++ (I tried to include the library, but it doesn't appear)
I want it without hardware
Please post the code that you tried, using code tags when you do
What does that mean ?
I wrote
include <ctime>
like regular C++ but it does not work
An Arduino can not pull information from a computer. You will need to write a program for the computer to get the date/time and send that to the Arduino.
Next you can write a program for the Arduino that understands the message that was send by the computer and uses the data in that message.
You can reverse the order of the two steps.
If date and time to the second will do, those can be encoded in 32-bits as Unix Time, good to 2038 and covered by the standard C time.h library. 4 bytes to go from 1901 to 2038 and there's a 64 bit version if that's not enough... infact there are many versions but see which your time.h covers.
If you log controller millis or micros then PC Unix time (cause serial data takes time) you can relate the two and only need to read PC time every so often and be pretty precise in between. If the PC sends once a second, that would be tight and time.h functions can use that to fill out time and date easily.
That is not a valid C or C++ statement.
No, but adding the "#" will make it one:
#include <ctime>
Just not on an AVR Board like Uno R3.
i built a furnace monitor where i specify the current date and time after reset, it converts it to stardard Unix time in secs and then tracks time by incrementing a secs count uing millis() know the count corresponding to the initialized date/time.
all event times are stored as a 32-bit (4 byte) count (secs) that can be converted back to ASCII data time (15 chars)
It will be once you install the ArduinoSTL library and add #include <ArduinoSTL.h> before any STL includes. Just don't expect full STL support.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.