IanalogReadf() converts the analog input value to the specified floating-point range.
float IanalogReadf(uint8_t ch, float min, float max)
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
IanalogReadf(ch, min, max) | uint8_t ch — Analog input pin or channel to readfloat min — Lower bound of the floating-point output rangefloat max — Upper bound of the floating-point output range | float | Converts the analog input value to the specified floating-point range. |
void setup() { Serial.begin(115200); } void loop() { float voltage = IanalogReadf(A0, 0.0F, 10.0F); // Map the analog input value to the specified floating-point range. Serial.println(voltage, 2); delay(500); }
min and max define the conversion range of the return value, not the actual electrical input range of the sensor.Iscalef() limits the result to the specified output range.min greater than max reverses the output range. Example: IanalogReadf(A0, 100.0F, 0.0F).ch appropriate to the selected board.