0

I wanted to connect the load cell with hx711 to Arduino to check the presence of load. If there is load on the load cell then an LED can light up and when there is no load the LED will be off. I tried several codes but I'm not getting the result I need. If anyone of you can help with this as this is for my graduation project I will be grateful.

EDIT:

Here is my code, I'm a beginner in Arduino so I don't know much about how it works but this is what I managed to write. PS. the hashtaq before include makes the the text in bold so I excluded it here.

include < HX711_ADC.h >

HX711_ADC scale (2,3); //DT pin2 , SCK pin3 
int load1 =0;

void setup() { 
   pinMode (3,INPUT); // SCK pin 
   pinMode (13,OUTPUT); //LED pin 
   Serial.begin(9600); }

void loop() { 
   load1= digitalRead(3); // read signal from SCK pin

   if(load1==HIGH) // if there is load on load cell 
        { 
        digitalWrite(13,HIGH); // turn on the LED 
        delay(5000); 
   } else {
       digitalWrite(13,LOW); // turn off the LED 
       delay(5000); 
   }
}
  • 1
    Can you show us the code you have written so far? – VE7JRO May 13 at 9:35
  • 1
    This isn't a forum. Don't respond to questions with an "answer". Amend your question. – Nick Gammon May 13 at 10:57
  • @bummi - Whoops sorry for the rejection, didn't realise that the edit was from the answer. My bad. – Greenonline May 13 at 11:52
  • look at the line starting with void setup() ... everything after the ; // all way to end of line is a comment .... it is not code that executes .... same goes for the two lines after that .... please correct the code listing – jsotola May 14 at 0:25
  • You are not using the github.com/bogde/HX711 library properly. Instead of load1=digitalRead(3); try something like load1 = scale.get_units(); (and initlialize the scale with a scale.begin() in setup and maybe a scale.tare() ) – Dave X May 31 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.