Hi I want to use a potentiometer to set a float value between x and x not relating to anything other than itself. As in I want to turn a potentiometer and have a value between 1 and 5 be returned by the program as I turn the nob. I'll be using this number as a reference for certain operations. Any idea how I would go about doing this?
Any idea how I would go about doing this?
analogRead() and map().
Where do you think the value will be returned to by "the program"?
coinmaster: between x and x not relating to anything other than itself.
What does that mean?
You want to turn the adc output (ranges from 0 - 1023) to a float value between 1.0 - 5.0?
If I understand correctly, this is the statement you want:
float value = 1.0 + 4.0 * analogRead(ADC_PIN) / 1023;