Pages: [1]   Go Down
Author Topic: Calibrating sensors - should be easy?  (Read 441 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Whats the equation for constraining a variable to a specific scale i.e. I have a light sensor that outputs an analog read value between 200 - 800 which I want to convert to a scale of 0-255
Ta for any help:)
Tom
Logged

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

OK found this:
http://www.arduino.cc/playground/Main/Fscale

which will convert one scale to another, but this seems like overkill as im only using integers - I do wish I was better at maths;)

Tom
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the integer-version of the scale function you where looking for...
http://www.arduino.cc/playground/Main/Autoscale

Never used it myself, I simply knew by accident it was somewhere on the playground...

Eberhard
Logged

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

Great,
Thanks for that Eberhard.
Tom
Logged

Pages: [1]   Go Up
Jump to: