I have a project where I'm using the HX711 library with a loadcell to weigh in a fruit that is on a conveyor belt. Each fruit has a weight which needs to be classed. The bigger fruits (200g) are class A so they have to "fall down" the conveyor belt at a later stage. The smaller fruits fall down earlier. This has to be done on a timed basis.

What I want to do is get the fruit size , calculate the class (using weight) and then send an interrupt to the dropping mechanism after x time. But while it must wait to drop the next fruit will be have come in and might be smaller than the first.

I can already weigh in and calculate the class of fruits. I've also done this in C using multithreading but adruino uno doesn't support that.

I also have to mention that there is about 50-200 fruits on a single conveyor belt at any given time.

  • 1
    Non-blocking code with millis() is the answer. Look at the BlinkWithoutDelay example, that comes with the Arduino IDE
    – chrisl
    Nov 10, 2019 at 22:14

1 Answer 1


You can use timestamp to avoid the blocking code. See BlinkWithoutDelay example

  • 1
    while this is true, it was answer many times. you should search for a duplicate
    – Juraj
    Nov 11, 2019 at 5:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.