Image shows what I am trying to doenter image description here I'm new to this platform and actually this is my first question on here.So I can read and write any figures in Arduino EEPROM apparently and it works as expected. Is it possible to do a comparison to check if there is a certain figure saved in the EEPROM and if its not equal to zero we print something on the serial monitor?. Basically all I'm saying is that is it possible to read something from the EEPROM and compare it with something not stored in EEPROM? I want this check to happen when I switch ON the Arduino. Where 65 is the address which helps me read the stored data from EEPROM and ag is the variable that holds the data read from EEPROM. I will be great full for any help given on the platform

  • 1
    Of course it's possible. What have you tried? – Edgar Bonet Sep 14 at 9:45
  • Do not answer my comment in a comment. Instead, edit your question and add the code of a minimal, complete and testable example. Clearly explain what you expected this code to do, and then what it actually did. – Edgar Bonet Sep 14 at 10:15
  • 2
    try EEPROM.get(65, ag); if (ag == 0) {.... What is ag? Post code as text, please – Juraj Sep 14 at 11:04
  • juraj, it doesnot work i tried it several times – Sigma Sep 16 at 6:31
  • 1
    what? to post the code as text? – Juraj Sep 16 at 6:54

There's a few issues that I have with your "way of coding".

  1. Please use "if(){...}else{...}" statements. And not "if(){...}else..."
  2. Mind your identation, go to tools -> auto-format
  3. Read and understand the error message.
  4. Use the correct functions
  5. If all else fails; and you're requesting help online; COPY AND PASTE the code; make a minimal running example to show the issue. Simply an empty project where you ONLY try to read the EEPROM value. And paste it along with your question; so we can copy it and try it out on our side.

Read and understand the error message

The line with "delay 2000;" is highlighted and the error "expected ';' before numeric constant" is produced.

This means that the "Numeric constant", the "2000" is not correctly placed; or that it expects a ";" before it.

Though putting a ";" will not fix it; it should indicate that there is something wrong with the call to the delay function and/or the value '2000' you're passing to it.

You forgot to put brackets ( ) around the arguments after the delay function. See your own code on line 190 as well; change line 185 to "delay(2000);" and you should be good to go.

Please try to put some more attention and care into your code; by failing to do so; your code will fail as well.

Use the correct functions/examples:

Please base your code on the official example code and not some random code you've found on the internet; read the actual help documentation of Arduino itself. EEPROM read Arduino

#include <EEPROM.h> //Put this at the top of your file/code
int address = 0; //The EEPROM address to read from.
byte value = EEPROM.read(address); //Read it and store in 'value'
  • 1
    Paul thanks actually I think I was in a hurry and I forgot a bunch of things and you are right I just figured I made stupid errors. Actually I don't get codes off the internet I sit down and try to put things together though this was an adjustment let and I guess I was tired lol I couldnot figure it out as some of the colleagues on the platform. Thanks big Paul let me try it an see if it works – Sigma Sep 16 at 11:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.