Store value hour counter


#1

Hi

I want to display the value of a hour counter in my project.
Thats not a problem.
But i want to store the value for the next start up.
So when i reboot my project the hour counter continues at the last stored value.
I tried several options with the buffer code, but i still have not figured it out.
Anyone suggestions?

Greetings
a beginner


#2

You won’t be able to store it in your code; code gets re-initialized every time board starts up. You would need to write to an SD card or similar to be able to read the value back in on startup.


#3

Ok, but the arduino does have a eeprom on board?
Or not?

Greets


#4

Arduino has an eeprom for storing the code that is you download to it, but I’ve never seen an API to provide programs access to it. I don’t think it is writable from outside the bootloader used to download code. You would need to add additional hardware (like an SD card reader) to be able to store persistent data from your program.


#5

This is why i asked it
https://www.arduino.cc/en/Tutorial/EEPROMWrite


#6

Looks like I was wrong. You should be able to use that. You will need to create nodes to read & write the data. Both will need to include EEPROM.h, which you will need to manually install under <user>\AppData\Local\Programs\xod-client-electron\resources\arduino-libraries. You will need to re-install these headers any time you update XOD. If you make the nodes generic (accept address & data as input/output), you can submit it as a new library. Developers are working on a way to provide header files, but for now they will need to be copied manually. gweimer/ir-remote is an example of how I tried to handle the header files (include them in the library under a folder that tries to give path to copy it to).

Note that EEPROMs have a limited number of write cycles. Too many writes, and your AVR chip will quit working. Writing to the EEPROM several times per second would be a bad idea.


#7

hi

Thx doe your reply


#8

thx for your reply
But i am just a beginner with arduino
ill wait :blush:
I thought it was so easy as the buffer node :roll_eyes: