Data output to display

Hi peeps. Just looking for a bit of advice for a scaling issue I have from a current to voltage converter.
I have a number of current to voltage converters which will be going on mechanisms which move in and out.

The converters will give an output of between 0-5V from an input of between -5 to +5A.

What I would like to do is feed the voltage into an Arduino, where upon I could output to a display. The issue is that I would like output to be the associated current value rather than the voltage.

How would I go about setting it up so that I get 2.5V = 0A and so on?

Any help would be greatly appreciated.

Dave

How would I go about setting it up so that I get 2.5V = 0A and so on?

map()

PaulS:
map()

Cheers Paul :slight_smile:

PaulS:
map()

Paul would this Map function work with none integer numbers?
I will require decimal numbers.

I will require decimal numbers.

You are not going to get them from analogRead(). That function returns an int. You could map 0 to 1023 to -500 to 500:

   int ar = analogRead(somePin);
   int cv = map(ar, 0, 1023, -500, 500);

   float A = cv/100.0;
   // A will now be between -5.0 and 5.0

PaulS:
You are not going to get them from analogRead(). That function returns an int. You could map 0 to 1023 to -500 to 500:

   int ar = analogRead(somePin);

int cv = map(ar, 0, 1023, -500, 500);

float A = cv/100.0;
  // A will now be between -5.0 and 5.0

Cheers Paul :smiley: