user20070: /*

 This example code uses bogde's excellent library: https://github.com/bogde/HX711
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE

 The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
 based load cell which should allow a user to measure everything from a few grams to tens of tons.
 Arduino pin 2 -> HX711 CLK
 3 -> DAT
 5V -> VCC
 GND -> GND

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#include "HX711.h"
#include <Servo.h>

float calibration_factor = -4050.0;

#define DOUT  3
#define CLK  2
Servo myServo;

HX711 scale(DOUT, CLK);

void setup() {
    Serial.begin(9600);
    Serial.println("Food Test");
    scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
    Serial.println("Readings:");
    myServo.attach(9);
    long zero_factor = scale.read_average(); //Get a baseline reading
    Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
    Serial.println(zero_factor);
}

void loop() {
    scale.set_scale(calibration_factor); //Adjust to this calibration factor

    if ((scale.get_units(), 1) <= 5) {
        Serial.print("whoa that is light, more food needed");
        myServo.write(90); // Open food hatch
        delay(2000);
        myServo.write(0);

        do {
            // Do nothing
            Serial.println("It is working somewhat");
            Serial.println(scale.get_units(), 1);
            delay(1000);
            // When weight exceeds 5 it should break out of this loop and go below
        } while ((scale.get_units(), 1) < 10);

        Serial.print("Closing the Hatch");
        myServo.write(0); // close food hatch
    } else {
        Serial.print("Something Went Wrong");
    }
}

Output:
It is working somewhat  
10.6
It is working somewhat
10.9
It is working somewhat
10.5
It is working somewhat
6.9
It is working somewhat
-0.8

I will try to explain the problem as best as I can. I am using a scale library and the scale.get_units(),x returns a value as a float. The whole point is that a servo will open and stay open until a specified weight of 10lbs is reached. As seen in the do, while loop that's what I specify. It jumps into the if loop and then into the do while loop, and it continually prints out values of readings which is what I want. BUT, even when I reach over 10lbs it will not break out of the Do/while loop, essentially it never satisfies the while condition and I have no clue why. It prints out values over 10 but keeps reading values. I know the format isn't the best but any help would be greatly appreciated!!

user4143: It looks to me like you have an extra bracket in there that you don't want.
At the moment your structure is:
if {
    do {
    }
} while...

As it stands your sketch won't compile. The unbalanced brackets prevent it.  Remove the excess one so that the while is associated with the do not the if and report back.

Part II
The main cause of your problem is the strange bit of code you have in your ifs and whiles.
if ((scale.get_units(), 1) <= 5) {

....

} while ((scale.get_units(), 1) < 10);

In both of those you have the bit (scale.get_units(), 1) which is completely meaningless.  The comma operator in C calls (or evaluates) both sides, and then returns the right hand side.  So that calls scale.get_units() and then returns 1.  1 has always been, and will always be, less than 10, so the while never ends.
I don't know what you were hoping to achieve by having the , 1 in there, but you should delete it from every place you have it.

20070: <pre><code>/*

 This example code uses bogde's excellent library: https://github.com/bogde/HX711
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE

 The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
 based load cell which should allow a user to measure everything from a few grams to tens of tons.
 Arduino pin 2 -&gt; HX711 CLK
 3 -&gt; DAT
 5V -&gt; VCC
 GND -&gt; GND

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#include "HX711.h"
#include &lt;Servo.h&gt;

float calibration_factor = -4050.0;

#define DOUT  3
#define CLK  2
Servo myServo;

HX711 scale(DOUT, CLK);

void setup() {
    Serial.begin(9600);
    Serial.println("Food Test");
    scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
    Serial.println("Readings:");
    myServo.attach(9);
    long zero_factor = scale.read_average(); //Get a baseline reading
    Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
    Serial.println(zero_factor);
}

void loop() {
    scale.set_scale(calibration_factor); //Adjust to this calibration factor

    if ((scale.get_units(), 1) &lt;= 5) {
        Serial.print("whoa that is light, more food needed");
        myServo.write(90); // Open food hatch
        delay(2000);
        myServo.write(0);

        do {
            // Do nothing
            Serial.println("It is working somewhat");
            Serial.println(scale.get_units(), 1);
            delay(1000);
            // When weight exceeds 5 it should break out of this loop and go below
        } while ((scale.get_units(), 1) &lt; 10);

        Serial.print("Closing the Hatch");
        myServo.write(0); // close food hatch
    } else {
        Serial.print("Something Went Wrong");
    }
}
</code></pre>

<p>Output:</p>

<pre><code>It is working somewhat  
10.6
It is working somewhat
10.9
It is working somewhat
10.5
It is working somewhat
6.9
It is working somewhat
-0.8
</code></pre>

<p>I will try to explain the problem as best as I can. I am using a scale library and the <code>scale.get_units()</code>,x returns a value as a float. The whole point is that a servo will open and stay open until a specified weight of 10lbs is reached. As seen in the do, while loop that's what I specify. It jumps into the if loop and then into the do while loop, and it continually prints out values of readings which is what I want. BUT, even when I reach over 10lbs it will not break out of the Do/while loop, essentially it never satisfies the while condition and I have no clue why. It prints out values over 10 but keeps reading values. I know the format isn't the best but any help would be greatly appreciated!!</p>
 4143: <p>It looks to me like you have an extra bracket in there that you don't want.</p>

<p>At the moment your structure is:</p>

<pre><code>if {
    do {
    }
} while...
</code></pre>

<p>As it stands your sketch won't compile. The unbalanced brackets prevent it.  Remove the excess one so that the <code>while</code> is associated with the <code>do</code> not the <code>if</code> and report back.</p>

<hr>

<h1>Part II</h1>

<p>The main cause of your problem is the strange bit of code you have in your <code>if</code>s and <code>while</code>s.</p>

<pre><code>if ((scale.get_units(), 1) &lt;= 5) {

....

} while ((scale.get_units(), 1) &lt; 10);
</code></pre>

<p>In both of those you have the bit <code>(scale.get_units(), 1)</code> which is completely meaningless.  The comma operator in C calls (or evaluates) both sides, and then returns the right hand side.  So that calls <code>scale.get_units()</code> and then returns 1.  1 has always been, and will always be, less than 10, so the <code>while</code> never ends.</p>

<p>I don't know what you were hoping to achieve by having the <code>, 1</code> in there, but you should delete it from every place you have it.</p>
