EEPROM READ

ArduinoPros,

The below code is that of EEPROM_READ with a little bit of alterations. The original code prints all the bytes with corresponding address i.e from 0 to 4096 → A to FF for Mega 2560.

I want the user to specify for which byte he wants the corresponding address.
Like for example:

Enter byte

30

Output should be

A

OR

Enter byte

4096

Output should be

FF

Could you guys tell me, what should be my approach?

#include <EEPROM.h>

int address;
byte value;
#define Bluetooth Serial1

void setup() 
{
  Serial.begin(9600);
  Bluetooth.begin(9600);
  while (!Serial) 
{;  
  }
    Serial.println("Enter value, Press ENTER");
     
  value = EEPROM.read(address);
  Serial.print(address);
  Serial.print("\t");
  Serial.print(value,HEX);
  Serial.println();
}
}
void loop()
{
}

Enter byte

4096

Output should be

No such address.

I know its not.

Oh I think, I wrote it wrong.
Sorry, my mistake!

So the code reads the value of each byte of the EEPROM and prints it. I want the user to enter a particular byte rather than having all of them printing from 0 to 4k

Your code is a good start. It appears your main problem is to read the Serial input, right?

That's correct.

I tried some different methods like Serial.read() but didn't do what I really wanted to.

Start here