@Bob That's hilarious lol. This was a quick sketch I wrote up. Should have looked it over a little better lol. Too bad even with declaring the write variable as double its still not working just like my original sketch.
@AWOL reading and writing is very easy so far although, writing a value with decimal point isn't working for me yet.
I tried the eepromex library to no avail either....
Any ideas? This is 100% working code though and I'll use this. I'm not sure why my first sketch didn't work, as I did it identical or I thought anyways.
"value: the value to write, from 0 to 255 (byte)"
and
"A byte stores an 8-bit unsigned number, from 0 to 255."
So, no decimals allowed. Looks like you need to split your number into 2 parts, the whole part and decimal part. Multiply the decimal part by 10, store the two resulting integers and do the reverse when you read them back. There may well be a library to do this that hides the mechanics of how it works. As I have never used the Arduino EEPROM I don't know if there is a better way.
There I go again.. I know why eeprom.h didn't work. I meant my original code that wasn't posted here. I 'thought' I did the same thing in my code as in the 100% working sketch. Just glad its working now. I get to finish up tomorrow. Too tired I think that's obvious haha!
Thanks again for all your input!!!!!!!
If you guys try the code it works. Now, I'm not 100% on 'how' it works but it does. When I go to add this into my real sketch I'll figure it out though so I know where to save info etc.
Maybe that library uses a template. In which case your 16-bit int writeValue was == 1 and that's what you got back out.
Also Arduino double is the same as Arduino float, both 32 bits. You're better off and way faster using fixed-point with long (32-bit) or long long (64-bit) variables.
Thanks for reply. I ended up just simply multiplying the double value by 100 then writing to eeprom. After that I used a variable to / by 100 into the sketch. Works pefectly.