Load Cell Help

I am a newbie to Arduino and I have a project that I need help with . I am reading a load cell that is measuring total weight of the contents of a container. i then want to subtract am amount that is define in the code. I then want to digitally turn on a switch that will trigger a relay ( relay shield), this will open a valve and dispense some contents. I want the code to do the math of the new weight of the container and then read the load cell and turn off the relay when the cell reaches the new calculated weight.
Not much for a newbie right!
I have the code working for the cell and it is reading and then outputting to a 16x2 LCD. But the rest is not going well. My code will switch the relay but is not held and then having the code turn it off.
I know I am in way over my head but this project depends on me getting this code to work. Any help or rewrite of my code is greatly appreciated.As I said I am a newbie so my code is not streamlined as I am not up to speed on all of the variables.

Thanks in advance!

// Arduino Load Cell Test
// 07-17-14 16:03 J_W
#include <LiquidCrystal.h>
//Put two know loads on Loadcell take readings. Enter values
float aReading =200.125;
float aLoad = 45.2; //grams
float bReading = 400.250;
float bLoad =90.5; //grams

long time = 0;
int interval =500; // Take reading every 500ms
int newAmount;
int pushButton =6;
int relay =7;
int feedAmount = 10;
int vin;
int newReading;
int state=HIGH;
int reading;
// Define LCD pins
LiquidCrystal lcd (12,11,3,2,1,0);
void setup() {
pinMode(pushButton,INPUT);
pinMode(relay,OUTPUT);
lcd.begin(16,2);
}

void loop() {
float newReading = analogRead (0);
// calculate load based on A and B readings above
float load = ((bLoad - aLoad )/(bReading - aReading)) * (newReading - aReading) + aLoad;
reading = digitalRead(pushButton);
//when button is pressed open valve to feed
(digitalRead(pushButton)==state);
//reads load cell value puts value in Vin
vin = load ;
//calculate the amount to deliver
newAmount = (vin-feedAmount);
if(newAmount<vin){
digitalWrite(relay,HIGH);
}
else{
digitalWrite(relay,LOW);
}
if(vin = newAmount){
digitalWrite(relay,LOW);
}

// millis returns the number of Milliseconds since the board started the current program
if(millis() > time + interval) {
// Display weight in ml
lcd.setCursor(1,0);
lcd.print ("Weight ml");
lcd.setCursor(7,1);
lcd.print(load,3);

time = millis();
}
}

Loadcell_LCD_Relay_V3.ino (1.41 KB)

//when button is pressed open valve to feed
  (digitalRead(pushButton)==state);
    //reads load cell value puts value in Vin
  vin = load ;

This bit of code seems to be totally meaningless.

You are going to need to develop some basic competency with understanding C/C++ code, you won't succeed by randomly sticking together bits of code that you copy from somewhere with no understanding of it.

I am amazed you actually got a load cell to work.

!!

if(vin = newAmount){

This doen not compare

change to:
if(vin == newAmount){