Fed up of 'weighting'.

Hi All, I'm new so please feel free to tell me I've messed up! :slight_smile:

I've had my Arduino several months. worked through the projects then thought I would make something I could do with.
The code is slowly going in and the more I do the better I get on. Hardware I'm good with :grin:

My code below is for an environment controller to dry cure sausage, it has a DHT (humidity/temp) sensor, relays for heater, fridge and humidifier the code for this I achieved and works, my next development is to add weigh cells using analogue to digital converter (hx711). I copied and pasted the code as I thought best as I don't understand the part to alter the calibration value (lines 156-162) and it produces the error.
It's still in development as I like to get it working in stages.
I'm looking for guidance to make the code so far work and also suggestions if needed.
Many Thanks Noel

Using library DHT sensor library in folder: C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master

Using library HX711-master in folder: C:\Users\Noel\Documents\Arduino\libraries\HX711-master (legacy)

Using library LiquidCrystal in folder: C:\Users\Noel\Documents\Arduino\libraries\LiquidCrystal

C:\Users\Noel\AppData\Roaming\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino2/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Noel\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino -IC:\Users\Noel\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\variants\standard -IC:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master -IC:\Users\Noel\Documents\Arduino\libraries\HX711-master -IC:\Users\Noel\Documents\Arduino\libraries\LiquidCrystal\src C:\Users\Noel\AppData\Local\Temp\build5886731554843320354.tmp\Fridge_Project1.ino.cpp -o C:\Users\Noel\AppData\Local\Temp\build5886731554843320354.tmp\Fridge_Project1.ino.cpp.o

Fridge_Project1.ino.ino: In function 'void loop()':
Fridge_Project1.ino.ino:160:26: error: lvalue required as left operand of assignment
Fridge_Project1.ino.ino:162:24: error: lvalue required as left operand of assignment
Multiple libraries were found for "LiquidCrystal.h"

Used: C:\Users\Noel\Documents\Arduino\libraries\LiquidCrystal

Not used: C:\Users\Noel\Documents\Arduino\libraries\LiquidCrystal-I2C

lvalue required as left operand of assignment

Fridge_Project1.ino.ino (4.23 KB)

Line 160 in the code you posted is a comment. There are no lvalues or rvalues in comments.

Therefore, the code you are trying to compile is not the code you posted.

I would suggest that you fix line 160 in the code you didn't post.

I commented it so I could compile it, if I uncomment it produces the error.

I've edited the code so it now makes the error.

#define calibration_factor -7050.0

    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
    calibration_factor -= 10;

After the preprocessor gets done, this bit of code looks like:

    if(temp == '+' || temp == 'a')
      -7050.0 += 10;
    else if(temp == '-' || temp == 'z')
    -7050.0 -= 10;

Does that seem like what you expect? If you are going to change the value of a variable, you need a variable, don't you? calibration_factor is NOT a variable.

Thank you, if I set the variable using int at the beginning that should do the trick?

NoelA:
Thank you, if I set the variable using int at the beginning that should do the trick?

At the beginning of what?
Are those modifications of the calibration supposed to remain in place after the loop executes, or is it something that you do each time you run the loop?

The calibration value remains in place.
I've sorted it now as I've found out using the variable 'int' for the calibration value doesn't work as it has a decimal place but 'float' does, I've now tidied the code up as well so it's easier on the eye and removed a few duplicated items.

Thank you for your comments and help.