Go Down

Topic: Adding sensor results? (Read 551 times) previous topic - next topic


Hello, I am currently working on a project where i am using the arduino to weigh small amounts. I am using a load cell and im converting the voltage changes to pounds. I want to have a total of every weight that is applied to the arduino over a period of time, can anyone tell me what is the best way to do this, any help will be greatly appreciated, thanks, TomDev.


Is this a trick question?

Just add each reading to a total. Make sure the total variable is large enough to hold the expected value.

Rob Gray aka the GRAYnomad www.robgray.com


Hey Rob cheers for the reply ,sorry no not a trick question im just extremely new to arduino and im not a programmer. With one sensor what kind of code would i use to add each reading to a total variable, thanks.


long total = 0;
#define COWS_NOT_HOME 1

    total += get_reading_from_sensor();

Rob Gray aka the GRAYnomad www.robgray.com



Welcome to Arduino land,
If you are new to the forum I would strongly advise you to spend a week or so on the reference and tutorial section of arduino.cc
There are a lot of sketches there that will learn you a lot about the HOW of the Arduino language, and how to do some things.
You will see a lot of code snippets that might be useful for your project.

The application you want to make is a good project to get started with - although the load-sensor can cause headaches depending on its interface.

BTW I can't give you any example sketch as I don't know the type of load cell you are using. The pseudo code above is in fact the right direction how to do it!

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131