radishlogic / MapFloat

Modified Arduino map function to have input, output and other parameters as float.
http://www.radishlogic.com/arduino/arduino-mapfloat-library-documentation/
14 stars 4 forks source link

ESP32S3 Warning #1

Open 369Martin369 opened 1 year ago

369Martin369 commented 1 year ago

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=*"

369Martin369 commented 1 year ago

Please add example

include "MapFloat.h"

define PIN_ANALOG 4

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); }