Internal EEprom read and write

Just was playing with internal EEprom and wrote this sketch

Before using check your internal EEprom size. i got Atmega 328. So my internal eeprom size is 1024 bytes. in HEX it is 400.. So the max size...

Enter String from Serial 6 chars max first char is command 0 or 1 3 after address and 2 after DATA if writing
and 4 char max with 1 on beginning if reading.

So address you enter and data you sending and receiving in HEX like in real life.

Very halpfull sketch if reading an internal EEprom from your phone by bluetooth.

i would like also aprove it, if passable by blocking any operation if i go over size it. for now it just spins So 1025 in my case is equals 0

#include <EEPROM.h>

//EEPROM.write(address, value)
//  value = EEPROM.read(a);
int value;

String Str;
String addresStr;
String dataStr;

 int long Ch1;
 int long Ch2;

void setup()
{
  Serial.begin(9600);
  Serial.println("Send 5 char max (com 0 or 1)(3 char adres hex) (2 char DATA to be written in HEX)");
  Serial.println("Exp 1400 - if read");
  Serial.println("Exp 01DDA1 - if write");
}

void loop()
{
  while(Serial.available()>0)
  {
    
   
    delay(10);
    Str = Serial.readString();
    
    
    Serial.println(" ");
    Serial.print("String you've send - ");
    Serial.print(Str);
    Serial.println(" "); 
    

   
    if(Str[0] == '0')
       {
        writeCycle();
        
         Serial.println(" ");
         Serial.print("Data - ");   //will dtermine address
         Serial.println (dataStr);
         Serial.print("has been writen into adress = ");
         Serial.print (Ch1);
         Serial.println(" ");  
       }
      
      if(Str[0] == '1')
        {
         readCycle();
            
         Serial.println(" ");
         Serial.print("Value of adress - ");   //will dtermine address
         Serial.println (Ch1);
         Serial.print("in HEX = ");
         Serial.print (value, HEX);
         Serial.println(" ");    
        } 
 
}
}

void writeCycle()
{
    addresStr = Str.substring(1,4);
    dataStr   = Str.substring(4,6);
   
   Ch1 = strtol(&addresStr[0], 0, 16);
   Ch2 = strtol(&dataStr[0], 0, 16);

   EEPROM.write(Ch1, Ch2);
}


void readCycle()
{
    addresStr = Str.substring(1,4);
   
    Ch1 = strtol(&addresStr[0], 0, 16);
   
   value =  EEPROM.read(Ch1);
   
 
}