Having problems creating weight ranges in order to control stepper motor

Hi there,
I am having trouble creating weight ranges in order to control a stepper motor. The idea is that if the weight falls in the first weight range, the stepper motor will turn X amount of steps and if the weight falls I the second weight range, the stepper motor will turn Y amount of steps. If the weight is outside both weight ranges, no steps will be made.

I am using a load cell and HX711 module as the sensor.

At the moment, the stepper motor does respond to a weight but will turn even if the weights fall outside of the weight ranges.

I have attached all my code below, any suggestions?

// load cell
#include "HX711.h"
#define DOUT 6
#define CLK 7
HX711 scale(DOUT, CLK);
float calibration_factor = 387600;

// hedgehog weight limits
int sensorMin = 0.350; // 350g
int sensorMax = 0.750; // 750g
int sensorMid = 0.450; // 450g
int sensValLow = constrain(scale.get_units(), sensorMin, sensorMid);
int sensValHigh = constrain(scale.get_units(), sensorMid, sensorMax);
const int delayBetweenFeeds = 6e+7; //1 minute

//stepper
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9); //dirPin = 8, stepPin = 9
int previous = 0;

//SD card
#include <SPI.h> //load SD card library
#include <SD.h> //load SPI library
//do i need the following?:
//Sd2Card card;
//SdVolume volume;
//SdFile root;
const int chipSelect = 10;
File hedgehogData; //Data object you will write your sesnor data to

#include <Adafruit_SleepyDog.h>

//#include <JeeLib.h> //include library for low power functions
//ISR(WDT_vect) {Sleepy:watchdogEvent/();} //setup for low power waiting

void setup() {
Serial.begin(9600);
//set up load cell
Serial.println("Press T to tare");
scale.set_scale(calibration_factor); //Calibration Factor obtained from first sketch
scale.tare();

pinMode(10, OUTPUT);
SD.begin(chipSelect);
}
void loop() {
//use load cell to weigh
Serial.print("Weight: ");
Serial.print(scale.get_units(), 3); //2 decimal points
Serial.println(" kg");
delay(1000);

//control dispensor with load cell readings and stepper
if (sensValLow){ //((scale.get_units()>sensorMin) && (scale.get_units()>sensorMid){
hedgehogData = SD.open("Weight.txt", FILE_WRITE);
Serial.print("Weight: ");
Serial.print(scale.get_units(), 3);
Serial.println(" kg");
myStepper.setSpeed(30);
Serial.println("stepperclockwise");
myStepper.step(400);
hedgehogData.println(scale.get_units(), 3);
hedgehogData.close();
Sleepy::loseSomeTime(10000); //instead of delay (10000)
}

else if (sensValHigh){ //((scale.get_units()>sensorMid)&&(scale.get_units()<sensorMax)){
hedgehogData = SD.open("Weight.txt", FILE_WRITE);
Serial.print("Weight: ");
Serial.print(scale.get_units(), 3);
Serial.println(" kg");
delay(100);
myStepper.setSpeed(30);
Serial.println("stepperclockwise");
myStepper.step(600);
delay(1000);
}

else {
myStepper.step(0);
}
}

afsmith102:
int sensValLow = constrain(scale.get_units(), sensorMin, sensorMid);
int sensValHigh = constrain(scale.get_units(), sensorMid, sensorMax);

This only sets the values of sensValLow and sensValHigh immediately after you power on your Arduino, and may not even get a good value since it will be done before the scale is calibrated or tared. I guess you are thinking that the scale will be read repeatedly with that code, but it's not the case. You need to move that code into your loop() function to do that.

Even then, your code won't work as you are expecting it to. The code inside this if:

if (sensValLow){

will not run when sensValLow is equal to 0 (boolean false) and it will run when sensValLow is any value other than 0. The same issue applies with your else if statement. That behavior does not match in any way the comments on those lines.

With this code, you're trying to run before you have learned to walk. You need to spend a little time studying the basics of the programming language, writing some very simple sketches using the concepts you learned, and then running those programs on your Arduino board to verify that they work as expected. You'll find a lot of useful information here:
http://www.arduino.cc/reference/en