i av done d coding part and my sensor is sensing values.. but i keep seeing errors and d tolerance is too wide.... and d values keep changing..
this is my code hope u help me speedily.. i also wanna incorporate keypad to tare change values and d rest
Moderator edit: added code tags.
this is my code hope u help me speedily.. i also wanna incorporate keypad to tare change values and d rest
Code:
#include <LiquidCrystal.h>
#include "HX711.h"
#define sw 2
float temp_reading = 0;
HX711 scale(A1, A0); // parameter "gain" is ommited; the default value 128 is used by the library
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
lcd.begin(16,2); // initialize the lcd
lcd.home();
lcd.setCursor(0,0);
lcd.print("HX711 Loadcell");
lcd.setCursor(0,1);
lcd.print("Zeroing ...");
delay(5000);
scale.set_scale(-583.3f); // this value is obtained by calibrating the scale with known weights; see the README for details
scale.tare(); // reset the scale to 0
lcd.clear();
}
void loop() {
lcd.setCursor(0,0);
lcd.print("Weight");
lcd.setCursor(0,1);
temp_reading = (scale.get_units());
if (temp_reading <0 )
{
temp_reading =0.00 ;
}
else
{
lcd.print(temp_reading ,2);
}
lcd.print(" Gram");
lcd.print(" ");
scale.power_down(); // put the ADC in sleep mode
delay(2000);
scale.power_up();
}