CAN SOMEONE PLEASE ASSIST ME WITH PROGRAMMING

Hi, I am in great need of assistance . I am working on a project for my final project . I am creating a device to monitor lpg remaining in a cylinder. I have already tested all the components,and have individual codes i found online and edited .. I will provide as much information as possible.
FIRSTLY LET ME SAY I AM NOT LOOKING FOR SOMEONE TO DO MY PROJECT FOR ME ... but i am very weak in programming . so I am seeking help in fixing my code , and provide any suggestion for future programming ,
with that said . I am using the arduino uno board . and i am using 3 push button for input , i just purchased a 20x4 lcd , but i did all my test on a 1602.. (i can make the lcd changes myself in the code) . my load cell is tested and calibrated .. i have added the code in the header of the code ...

the actual code , i wrote a bunch of stuff based on what i understand , please do not be too judgmental i am a not an expert . there are some notes within the code that i actually need function and codes , but i am still researching how to write it ... so i just use " // then type what should be before them .. please do not erase them but write the code in-front of them ...

/* THIS CODE WORKS !! IT GET ACCURATE READINGS FROM LOAD CELL )

  #include "HX711.h"

  #define calibration_factor -8360.0 //This value is obtained using the SparkFun_HX711_Calibration sketch

  #define DOUT  3
  #define CLK  2

  HX711 scale(DOUT, CLK);

  void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare();  //Assuming there is no weight on the scale at start up, reset the scale to 0

  Serial.println("Readings:");
  }

  void loop() {
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1); //scale.get_units() returns a float
  Serial.print(" lbs"); //You can change this to kg but you'll need to refactor the calibration_factor
  Serial.println();
  }
  1*/

/* This code will be the application for the scale  the setup is already done in precious section */

// anolog pin A0,A1 and A3 will be used as digital pin for the input of the push buttons
// anolog pin A0,A1 and A3 is the same as 15,16,and 17

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin[] = {15, 16, 17};   // the number of the pushbutton pins
const int buzzer = 13;

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status


//configure pinS as input and enable the internal pull-up resistor

void setup() {

  // initialize the pushbutton pin as an input:
  for (int x = 15; x <= 17; x++)
  {

    pinMode(buttonPin[x], INPUT); // Keep in mind the pullup means the pushbutton's// logic is inverted. It goes HIGH when it's open,
    digitalWrite(buttonPin[x], HIGH)// and LOW when it's pressed
  }

}



lcd.clear();
lcd.print(" PLEASE CLEAR SCALE ");  //print  " PLEASE CLEAR SCALE " ;
lcd.setCursor(0, 1);
lcd.print("PRESS 1 WHEN COMPLEATE"); //print  "PRESS 1 WHEN COMPLEATE" ;

//Wait for response;
// When 1 is pressed cLar scale

// read the state of the pushbutton value:
for (int x = 15; x <= 17; x++)
{
  buttonState = digitalRead(buttonPin[x]);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is LOW:
  if (buttonState == lOW && buttonPin[x] == 15) {

  }
  // CLEAR SCALE:    FROM CODE ABOVE

  scale.tare();  //Assuming there is no weight on the scale at start up, reset the scale to 0


  lcd.clear(); // Clear Screen
  lcd.print(" CHOOSE YOUR CYLENDER SIZE"); //print  " CHOOSE YOUR CYLENDER SIZE"
  lcd.setCursor(0, 1);
  lcd.print(" For 25 lbs --> Press 1 "); // print ) " For 25lbs --> Press 1 "
  lcd.setCursor(0, 2);
  lcd.print(" For 30 lbs --> Press 2 ") // print  " For 30lbs --> Press 2
  lcd.setCursor(0, 3);
  lcd.print(" For 100 lbs --> Press 3 ") // print  " For 100lbs --> Press 3 "

  // WAIT FOR RESPONSE

  // read the state of the pushbutton value:
  for (int x = 15; x <= 17; x++)
  {
    buttonState = digitalRead(buttonPin[x]);

    // check if the pushbutton is pressed.

    // SETTING MY REFERENCE VALUES

    // if it is, the buttonState is LOW:
    if (buttonState == LOW && buttonPin[x] == 15) {
      // make RefWeigntFull = 48 lbs;
      //and RefWeightEmpty = 24 lbs;
    }
    if (buttonState == LOW && buttonPin[x] == 16) {
      //make RefWeigntFull = 61 lbs;
      // and RefWeightEmpty = 30 lbs;
    }
    if (buttonState == LOW && buttonPin[x] == 17) {
      //make RefWeigntFull = 169 lbs;
      //and RefWeightEmpty = 70 lbs;
    }
  }

  lcd.clear(); // Clear Screen
  lcd.print("PLACE CYLENDER ON SCALE"); // Print " PLACE CYLENDER ON SCALE "
  lcd.setCursor(0, 1);
  lcd.print(" press 1 when compleate ");// Print " press 1 when compleate 1 "

  WAIT FOR RESPONSE

  // read the state of the pushbutton value:
  for (int x = 5; x <= 17; x++)
  {
    buttonState = digitalRead(buttonPin[x]);

    // check if the pushbutton is pressed.

    // if it is, the buttonState is LOW:
    if (buttonState == LOW && buttonPin[x] == 15) {


      // read load cell = scale.get_units(),
      // calculation
      // ([scale.get_units() / RefWeightFull ] * 100) = PercentageGasLeft

      lcd.setCursor(10, 1);
      lcd.print(" PercentageGasLeft " & "%");

      if (PercentageGasLeft = 20 % ) {
        lcd.clear();
        lcd.print(" Alert ");
        lcd.setCursor(0, 1);
        lcd.print(" 20 % gas left ");
        digitalWrite(buzzer, LOW);
        delay(500);
        digitalWrite(buzzer, HIGH);
        delay(500);
        digitalWrite(buzzer, LOW);
        delay(500);
        ONCE EVERY 20 MINS ..
      }

      if (PercentageGasLeft = 10 % ) {
        lcd.clear();
        lcd.print(" Alert ");
        lcd.setCursor(0, 1);
        lcd.print(" 10 % gas left ");
        digitalWrite(buzzer, LOW);
        delay(500);
        digitalWrite(buzzer, HIGH);
        delay(500);
        digitalWrite(buzzer, LOW);
        delay(500);
        ONCE EVERY 10 MINS ..
      }

      if (PercentageGasLeft , <= 5 % ) {
        lcd.clear();
        lcd.print(" CRITICALLY LOW LEVEL ");
        lcd.setCursor(0, 1);
        lcd.print(" ( PercentageGasLef t) % gas left ");
        digitalWrite(buzzer, LOW);
        delay(500);
        digitalWrite(buzzer, HIGH);
        delay(500);
        digitalWrite(buzzer, LOW);
        delay(500);
        ONCE EVERY 5 MINS ..
      }

    }

First of all, no need to use caps lock on your post title, I can assure you that won't help your cause.

It looks like you're on the right track and have a decent general plan of how to implement this project but you just need to break it down into parts and create test sketches to get each part right instead of trying to write the whole program from start to finish.

Here's a bit of advice on your code:

jasonjj:

  // initialize the pushbutton pin as an input:

for (int x = 15; x <= 17; x++)
 {

This is wrong, you have put the button pins in an array, which is a good idea, but the array is zero indexed so this means it should be

for (int x = 0; x <= 2; x++)

This will step through the 3 items in the array. Also, not a big deal in this case, but if you only need to count to 2 then you don't need x to be an int, a byte would be a more appropriate type.

jasonjj:
lcd.print(" PLEASE CLEAR SCALE "); //print " PLEASE CLEAR SCALE " ;
[/code]

You should change all of these to:

lcd.print(F(" PLEASE CLEAR SCALE "));  //print  " PLEASE CLEAR SCALE " ;

this puts the string into Flash instead of SRAM and you have 16X more of that.

jasonjj:
// ([scale.get_units() / RefWeightFull ] * 100) = PercentageGasLeft
[/code]

You're trying to set the value of PercentageGasLeft so it should be

PercentageGasLeft = ([scale.get_units() / RefWeightFull ] * 100);

There's another problem with this equation but since you're not looking for someone to do your project for you I'll let you figure it out, but this is very important to get right since it's the whole point of the project. Hint: think about what will happen when the cylinder is empty.

jasonjj:
if (PercentageGasLeft = 20 % ) {
[/code]

Two things here: you probably want to use == instead of = here otherwise you're setting the value of PercentageGasLeft to 20. Also you don't want the % on there.

jasonjj:
ONCE EVERY 20 MINS ..
[/code]

Not sure what this means

You need to put most of that code into the loop() function.

Well, spend some time on this until you can come back with some better code and more specific questions.

Hey pert .I really appreciate your feedback . I have made a little progress since i made this post. . I will definately look into all your suggestions and make changes. And thanks for pointing out my equation problem . Now you have me thinking about it .and i will never get a true zero . When it is empty. .

Ok, dude: this should sort of do what you want. If you like it, karma me!

You'll need to put in the headers and whatnot for your LCD and your load cell. I go to some trouble to not be updating the LCD all the time, and of course it isn't tested. But I think I have the logic and flow right.

All of the code to update the LCD is commented out, because I don't have an LCD (obviously).

There is one 'tare' button. When it's down, the display says "taking tare, ensure scale is clear". When you release it, the measurement is taken.

There is one cylinder select button, that cycles through your available cylinder types.

The cylinder types are described with a name, so you can put in whatever text you want ("Fat Boy 150lb").

I detect the "no cylinder" condition by a ref wt of 10, which is less than your smallest minimum weight. You should get a blip from the alarm as you lift a cylinder off the scale, because in that brief instant the sketch will think that it's <5% full.

/*
   Sketch for jasonjj,

   http://forum.arduino.cc/index.php?topic=378198.0

   This sketch does not include any setup, etc - it doesn't
   do anything with hardware. jasonjj will have to do that.
*/

// I prefer to put all my pins in a single enum
// and I like to suffix them with 'pin' so I do't confuse pin
// numbers with pin readings

enum Pinout {
  scaleDoutPin = 3,
  scaleClkPin = 4,

  tareButtonPin = 5,
  selectButtonPin = 6,

  buzzerPin = 7,

  // also need pinout for the LCD
};

struct CylinderType {
  const char *name;
  const float refWtEmpty;
  const float refWtFull;
};

const float refWtNoCylinder = 10; // if the weight is <10 above tare, the scale is empty.

struct CylinderType cylinderTypes[] = {
  {"25lb Cylinder", 24, 48},
  {"30lb Cylinder", 30, 61},
  {"100lb Cylinder", 70, 169},
};

enum AlarmLevel {
  scale_empty = 0,
  alarm_5 = 1,
  alarm_10 = 2,
  alarm_20 = 3,
  alarm_ok = 4
};

struct AlarmBuzzer {
  const unsigned long cycleTime;
  const unsigned long beepLength;
  const unsigned int beepCount;
  const char* message;
};

struct AlarmBuzzer alarms[] = {
  // scale_empty: no alarm
  { 0, 0, 0,
    "                          "
  },
  // alarm_5: five short beeps every 5 minutes
  { 5 * 60 * 1000L, 250, 5,
    "** CRITICALLY LOW LEVEL **"
  },
  // alarm_10: one long beep every 10 minutes
  { 10 * 60 * 1000L, 500, 1,
    "WARNING                   "
  },
  // alarm_20: one long beep every 20 minutes
  { 20 * 60 * 1000L, 500, 1,
    "WARNING                   "
  },
  // alarm_ok: no alarm
  { 0, 0, 0,
    "                          "
  },
};

unsigned long alarmStart;

int currentCylinderType;

enum AlarmLevel alarmLevel = scale_empty;
boolean tareButtonDown = false;
boolean selectButtonDown = false;
boolean redisplayAll = true;

int scaleReadingPercent;

void setup() {
  // no setup - jasonjj will need to fill this bit in
}

void loop() {
  // read all sensors at the top of the loop

  boolean tareButtonDownNow = digitalRead(tareButtonPin) == LOW;
  boolean selectButtonDownNow = digitalRead(selectButtonPin) == LOW;

  /////////////////////////////////////////////////
  // handle the TARE button

  if (tareButtonDownNow != tareButtonDown) {

    if (tareButtonDownNow) {
      // tare button pressed
      cancelAlarm();
      // uncomment this next block to update the LCD
      /*
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("** TAKING TARE **");
        lcd.setCursor(0, 1);
        lcd.print("ENSURE SCALE IS CLEAR");
      */
    }
    else {
      // tare button released
      // uncomment this next block to take the tare
      /*
         scale.tare();
      */
      redisplayAll = true;
    }

    tareButtonDown = tareButtonDownNow;
  }

  if (tareButtonDown) {
    // if the tare button is down, then we don't do anything else
    return;
  }

  /////////////////////////////////////////////////
  // handle the SELECT button

  if (selectButtonDownNow != selectButtonDown) {
    cancelAlarm();
    // select button pressed *and* the tare button not pressed
    if (selectButtonDownNow && !tareButtonDownNow) {
      cancelAlarm();
      currentCylinderType++;
      if (currentCylinderType >= sizeof(cylinderTypes) / sizeof(*cylinderTypes)) {
        currentCylinderType = 0;
      }

      redisplayAll = true;
    }

    selectButtonDown = selectButtonDownNow;
  }

  if (selectButtonDown) {
    // if the select button is down, then we don't do anything else
    return;
  }


  /*
   * At this point, we need to display the "normal" scale display.
   * if scaleReadingPercent is -1000, then that means that the whole diosplay needs to be cleared and
   * redrawn
   */

  if (redisplayAll) {
    // uncomment this next block to update the LCD
    /*
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(cylinderTypes[currentCylinderType].name);
    */
  }

  /////////////////////////////////////////////////
  // read the scale

  float scaleReadingNow = 0;
  // uncomment this next block to read the scale
  /*
    scaleReadingNow = scale.get_units();
  */

  int scaleReadingPercentNow =
    (scaleReadingNow - cylinderTypes[currentCylinderType].refWtEmpty) /
    (cylinderTypes[currentCylinderType].refWtFull - cylinderTypes[currentCylinderType].refWtEmpty);

  enum AlarmLevel alarmLevelNow;

  if (scaleReadingNow < refWtNoCylinder) {
    alarmLevelNow = scale_empty;
  }
  else if (scaleReadingPercentNow <= 5) {
    alarmLevelNow = alarm_5;
  }
  else if (scaleReadingPercentNow <= 10) {
    alarmLevelNow = alarm_10;
  }
  else if (scaleReadingPercentNow <= 20) {
    alarmLevelNow = alarm_20;
  }
  else  {
    alarmLevelNow = alarm_ok;
  }

  if (alarmLevelNow == scale_empty && (redisplayAll || alarmLevel != scale_empty)) {
    // uncomment this next block to update the LCD
    /*
    lcd.setCursor(0, 1);
    lcd.print(" -- NO CYLINDER --  ");
    */
  }
  else if (alarmLevelNow != scale_empty && (redisplayAll || alarmLevel == scale_empty)) {
    // uncomment this next block to update the LCD
    /*
    lcd.setCursor(0, 1);
    lcd.print(" Gas remaining:     ");
    */
  }


  if (alarmLevelNow != scale_empty && (redisplayAll || scaleReadingPercentNow != scaleReadingPercent)) {
    // uncomment this next block to update the LCD
    /*
    lcd.setCursor(16, 1);
    lcd.print(scaleReadingPercentNow);
    lcd.print("%  ");
    */
    scaleReadingPercent = scaleReadingPercentNow;
  }

  if (alarmLevelNow != alarmLevel || redisplayAll) {
    cancelAlarm();
    // uncomment this next block to update the LCD
    /*
    lcd.setCursor(0, 2);
    lcd.print(alarms[alarmLevelNow].message);
    */
    alarmLevel = alarmLevelNow;
    alarmStart = millis();
  }

  redisplayAll = false;

  handleAlarm();
}

void cancelAlarm() {
  alarmLevel = scale_empty;
  digitalWrite(buzzerPin, LOW);
}

void handleAlarm() {
  if (alarms[alarmLevel].cycleTime == 0) {
    digitalWrite(buzzerPin, LOW);
    return;
  }

  unsigned long ms = millis() - alarmStart;

  // handle alarm cycle time
  if (ms >= alarms[alarmLevel].cycleTime) {
    alarmStart = millis();
    ms = 0;
  }

  // ok. which beep cycle are we in?
  // remember that we have to double things, because
  // each beep has an equal-length quiet bit

  unsigned long whichBeep = ms / alarms[alarmLevel].beepLength;
  if (whichBeep >= alarms[alarmLevel].beepCount * 2) {
    digitalWrite(buzzerPin, LOW);
  }
  else if (whichBeep % 2 == 0) {
    digitalWrite(buzzerPin, LOW);
  }
  else {
    digitalWrite(buzzerPin, HIGH);
  }

}