Go Down

Topic: scale/resistance voltage for pin (0) (Read 779 times) previous topic - next topic

jlb37330

Oct 16, 2012, 11:12 am Last Edit: Oct 16, 2012, 11:25 am by jlb37330 Reason: 1
I am wanting to get reading from a temp sending unit,  voltage is scaled 0-5v  and resistance  is from 13.5k  to  20ohms.
I  know pin0  can  read 1024  different  levels, I only want to break this into 4 or 5 sections , example  only know if  it is  >2500 , <2500 but > 450,  etc. or could I  do it a different way and measure the voltage?  >1v  but  < 3v?
  I am using  an arduino mega 2560 and  pololu vnh5019. I am trying to  use these readings to  drive an actuator to  4 or 5 different positions depending upon temp.
Could anyone help me with this? I hope I explained it correctly.

PaulS

The value returned by analogRead() is indeed in the range of 0 to 1023. You can use the map() function to map that to a different range. Or, a series of if/else if/else statements can select non-uniform ranges, if that works better.


Go Up