Arduino - How to Save an Int into EEPROM

Sdílet
Vložit
  • čas přidán 23. 07. 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

Komentáře • 28

  • @rafaelcosta6757
    @rafaelcosta6757 Před rokem

    thank you, my friend, you saved my life :)

  • @amandaschulze5093
    @amandaschulze5093 Před 2 lety

    Man that's one awesome video. You explained that verry well and well understandable! Great video

  • @thanatlikitchontarn4923
    @thanatlikitchontarn4923 Před 3 lety +1

    easy to understand thank you for video

  • @Gocast2
    @Gocast2 Před 2 lety

    Great explanation! learnt a lot

  • @ElectroDevices-yi4mj
    @ElectroDevices-yi4mj Před rokem

    Great Tutor ... 🔥🔥

  • @nuwannx
    @nuwannx Před 11 měsíci

    Thank you soo much ❤

  • @johnalbu2319
    @johnalbu2319 Před 2 lety

    Thank You, Thank You

  • @nikhiljoshi2769
    @nikhiljoshi2769 Před rokem

    Superb

  • @Europayacht
    @Europayacht Před 2 lety

    Merci beaucoup!
    .

  • @manfredbogner9799
    @manfredbogner9799 Před měsícem

    Sehr gut

  • @men810
    @men810 Před 2 lety

    Toll
    Danke

  • @jhengineering3578
    @jhengineering3578 Před 2 lety

    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.

    • @RoboticsBackEnd
      @RoboticsBackEnd  Před 2 lety +2

      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/

    • @jhengineering3578
      @jhengineering3578 Před 2 lety

      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>>' ".

    • @Flyingeagle4998
      @Flyingeagle4998 Před 2 lety

      @@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?

  • @Reaching1
    @Reaching1 Před rokem

    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

    • @RoboticsBackEnd
      @RoboticsBackEnd  Před rokem +1

      Here you can find an example to store 4 bytes: roboticsbackend.com/arduino-store-int-into-eeprom/

  • @lobmati5998
    @lobmati5998 Před 2 měsíci

    How do I need to shift when I want to use longs and doubles?

  • @alvinkuhutan2914
    @alvinkuhutan2914 Před 2 lety

    how to read and write a long integer in EEPROM?

  • @verlidesouza
    @verlidesouza Před rokem +1

    If you can't store values over 32768 without it being negative, make sure you're using an unsigned integer!

  • @kimvuivoon4858
    @kimvuivoon4858 Před rokem

    Nice video, May I know what is mean by address +1?

    • @RoboticsBackEnd
      @RoboticsBackEnd  Před rokem

      "address + 1" means that if the current address is, let's say 178, then the "address + 1" will access the address 179

  • @imwhatim7259
    @imwhatim7259 Před rokem

    What about float value

    • @RoboticsBackEnd
      @RoboticsBackEnd  Před rokem

      A float is stored on more bytes than an int, so you'll have to split the number into more bytes.

  • @adrianjosol4712
    @adrianjosol4712 Před 2 lety

    Or just use the put() and get() functions