Pages: [1]   Go Down
Author Topic: Adding sensor results?  (Read 380 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8594
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8594
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

long total = 0;
#define COWS_NOT_HOME 1

while (COWS_NOT_HOME)
    total += get_reading_from_sensor();

smiley
______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 221
Posts: 13848
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@TomDev

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!

Regards,
Rob
Logged

Rob Tillaart

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

Pages: [1]   Go Up
Jump to: