Issue with EEPROM Writing to all addresses

GolamMostafa:
Can you please, post the complete program codes? There are many variables (say, inPin) in your program whose definitions are not there; therefore, it is difficult to test your exact case.

Okay here's the full code formatted code, there are some variables in there that can be ignored(part of a different program)

// These constants won't change. They're used to give names to the pins used:
const int analogInPin = A0;  // Analog input pin that the sensor is attached to
const int analogInPin1 = A1;  // Analog input pin that the sensor is attached to


int sensorValue1HP = 0;        // value read from the pot
int sensorValue2LP = 0;        // value read from the pot

String  stringOne, stringTwo, stringThree;

const int numReadings = 20;


int outputValue1 = 0;        // value output to the PWM (analog out)
int outputValue2 = 0;        // value output to the PWM (analog out)

int inPin = 2;   // choose the input pin (for a pushbutton)
int inPin2 = 4;   // choose the input pin (for a pushbutton)

int val_pb = 0;     // variable for reading the pin status
int val_pb2 = 0;     // variable for reading the pin status

int zerovalueHP = 0;     // variable for reading the pin status HP
int zerovalueLP = 0;     // variable for reading the pin status LP

int addressHP = 0;
int addressLP = 0;

int addressHP12 = 0;
int addressLP13 = 0;


int valueHPZERO = 0;
int valueLPZERO = 0;

byte valueHP;
byte valueLP;

int scaledpressure;


#include <EEPROM.h>                                                       //include libary for storage 

void setup() {
  pinMode(inPin, INPUT);                                                 // declare pushbutton as input#
  pinMode(inPin2, INPUT);                                                // declare pushbutton as input#


  Serial.begin(9600);                                     // initialize serial communications at 9600 bps:

}

void loop() {

  val_pb = digitalRead(inPin);                                          // read input value
  val_pb2 = digitalRead(inPin2);      // read input value

  valueLP = EEPROM.read(addressLP13);

  valueHP = EEPROM.read(addressHP12);

  if (val_pb == HIGH) {                                                   //check switch if it is on , if it is run code

    int zerovalueHP = analogRead(analogInPin) / 4;                        //read analog pin divide by 4 as storage can only store 255 and equal zerovalueHP to that value
    EEPROM.write(addressHP12, zerovalueHP);                                  //write to storage the zero value to location

    valueHP = EEPROM.read(addressHP12);                                     //read the address and equal int value to it

  }

  if (val_pb2 == HIGH) {

    int zerovalueLP = analogRead(analogInPin1) / 4;
    EEPROM.write(addressLP13, zerovalueLP);

    valueLP = EEPROM.read(addressLP13);

  }

  Serial.print(valueLP);
  Serial.println();

  Serial.print(valueHP);
  Serial.println();

  delay (1000);

}