Weight sensor output 0V when the load less than 150g,so we can not directly measure the load .My method is using a 200g local avoid measure blind spot.Read the analog data of 200g weight as no-load(0g),read the analog data of 700g weight as full load(500g).
void setup() { Serial.begin(9600); } void loop() { int value; value = analogRead(0); Serial.println(value); }
To put the measured value into a variable for further processing, replace the code in void loop with:
Start test program
void setup() { Serial.begin(9600); } void loop() { int value; value = analogRead(0); Serial.println(value); }
Full program
from http://www.instructables.com/id/Arduino-Load-Cell-Scale/
Code:
/* sample for digital weight scale of hx711 * library design: Weihong Guan (@aguegu) * library host on *https://github.com/aguegu/ardulibs/tree/3cdb78f3727d9682f7fd22156604fc1e4edd75d1/hx711 */ // Hx711.DOUT - pin #A2 // Hx711.SCK - pin #A3 #include <Hx711.h> Hx711 scale(A2, A3); void setup() { Serial.begin(9600); } void loop() { Serial.print(scale.getGram(), 1); Serial.println(" g"); delay(200); }
To put the measured value into a variable for further processing, replace the code in void loop with:
float value = scale.getGram();
Serial.print(value);
Serial.println(" g");
delay(200);

No comments:
Post a Comment