I have a question concerning the usage of the map function.
I have an Arduino Uno Board that is connected to a soil moisture sensor. The sensor has a max output voltage of 4.2V.
I would like to use the map function to set the readings between 0 - 100.
I know that the reading can be between 0 - 1023 however since the max ouput voltage of the sensor is 4.2v I am not sure if the max reading is 1023 or that the max reading is (1023 / 5) *4.2 = 859.32.
You did not show us your wiring so it is impossible to answer your question, but (and the reference documentation points this out at least twice) the map(...) function only works with integers. The reference documentation shows the function. You may need a similar function with every use of "long" replaced by "double". The name of the function should be something new as well, perhaps "mapDouble".