Arduino - How to Save an Int into EEPROM
HTML-код
- Опубликовано: 6 июл 2024
- Learn how to save an Int variable into the EEPROM of your Arduino. To do that you will need to split the integer into multiple bytes, and store each byte on a different address.
👉 Complete Arduino Course for Beginners: 🔥 rbcknd.com/arduino-for-beginners 🔥
✅ Click Here for the Corresponding Written Tutorial - Store an Int into EEPROM: roboticsbackend.com/arduino-s...
0:00 Intro
0:40 How to store an Int into EEPROM
2:07 Check how many bytes in a data type
3:03 Write Int into EEPROM
6:41 Read Int from EEPROM
8:34 Test the code and recap
9:41 Improve the EEPROM functions
10:56 Outro
👉 Get all my courses here 👉 rbcknd.com/all-courses
Twitter: / roboticsbackend
More Free Tutorials: roboticsbackend.com
Man that's one awesome video. You explained that verry well and well understandable! Great video
easy to understand thank you for video
Great explanation! learnt a lot
Great Tutor ... 🔥🔥
thank you, my friend, you saved my life :)
Thank you soo much ❤
Thank You, Thank You
Merci beaucoup!
.
Superb
Sehr gut
Toll
Danke
How do I need to shift when I want to use longs and doubles?
Hi, thanks for explaining in depth, how to read and write to EEPROM by manually shifting the bits, without relaying on predefined arduino functions. I have a question if I could replicate the procedure and store 4 byte floats? Thank you.
Yes, for a 4 bytes number you just need a few more lines of code, but the procedure is exactly the same!
Check out the end of this article where I explain how to store a 4 bytes (long) data type. You should be able to get inspiration from that to store a float. roboticsbackend.com/arduino-store-int-into-eeprom/
Thanks for the replay! I ended up storing the float by incrementing the address. I've tried to replicate the code by using the long data type example code, but I get this error saying " invalid operands of types 'float' and 'int' to binary 'operator>>' ".
@@jhengineering3578 Hi, how did you solve that error exactly? when you said storing the float by incrementing the address, do you mean you placed a for loop in there?
how to read and write a long integer in EEPROM?
is there some example on how to alter your code in order to save and read more than 2 bytes? I need 4 bytes to save a big number. your example works really well, but I can't find out how to change the code to save and read 4 bytes instead of just 2
Here you can find an example to store 4 bytes: roboticsbackend.com/arduino-store-int-into-eeprom/
If you can't store values over 32768 without it being negative, make sure you're using an unsigned integer!
Nice video, May I know what is mean by address +1?
"address + 1" means that if the current address is, let's say 178, then the "address + 1" will access the address 179
What about float value
A float is stored on more bytes than an int, so you'll have to split the number into more bytes.
Or just use the put() and get() functions