Guest User

Untitled

a guest
Jun 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include "HX711.h" 
  2. #define DOUT  3
  3. #define CLK  2
  4.  
  5. HX711 scale(DOUT, CLK);
  6.  float calibration_factor = -50000;
  7.  void setup() {
  8.   Serial.begin(9600);  
  9.   Serial.println("Press T to tare");
  10.   scale.set_scale(-96650);  
  11.   scale.tare();               
  12. }
  13.  
  14. void loop() {
  15.   Serial.print("Weight: ");
  16.   Serial.print(scale.get_units(), 3);  
  17.   Serial.println(" kg");
  18.  
  19.   if(Serial.available())
  20.   {
  21.     char temp = Serial.read();
  22.     if(temp == 't' || temp == 'T')
  23.       scale.tare();       
  24. }
  25. }
Add Comment
Please, Sign In to add comment