Open 369Martin369 opened 1 year ago
Please add example
void setup() { Serial.begin(115200); // Initialize Serial while(!Serial); // Wait for Serial Connection }
void loop() {
// Read the Analog Value of A4 pin.
int analogValue = analogRead(PIN_ANALOG);
float outputValue;
// Computation for the Voltage Value using mapFloat
switch (analogValue) { case 0 ... 225: outputValue = mapFloat(analogValue, 0, 225, 0.100, 0.20); break; case 226 ... 300: outputValue = mapFloat(analogValue, 226, 300, 0.201, 0.25); break; case 301 ... 438: outputValue = mapFloat(analogValue, 301, 438, 0.251, 0.30); break; case 439 ... 3950: outputValue = mapFloat(analogValue, 439, 3950, 0.301, 1.85); break; case 3951 ... 4095: outputValue = mapFloat(analogValue, 3951, 4095, 1.851, 1.95); break; }
Serial.println("Original="+ String(analogValue) + " calculated:" + String(outputValue,4)); delay(1000); }
WARNING: library MapFloat claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s)....
Please change in library.properties to "architectures=*"