Converting pot reading range from 1.0 to 0.0

Status
Not open for further replies.

Mowgli

Member
I've been googling for ages to find something that I thought would be straight forward.

I want to convert the reading of a pot to a range from 1.0 to 0.0. To one decimal place that is. I keep finding ways to convert to 1 decimal place using Serial.print but that's not what I want, I want the actual variable to change to that.

There has to be a simple way!
 
hi

try something like:
Code:
// if pot_raw_value is an int holding the value of the pot 0-1023
//

float pot_value = floor(pot_raw_value/102.3f)/10.0f;
 
Status
Not open for further replies.
Back
Top