the return value of map() above is stored in an integer, so it is not a floating point value. However, currently it will only reach 3 when the sensor is at sensorMax(or more). If you want the range to be more evenly spaced across the four values, then use map(sensorReading, sensorMin, sensorMax, 0, 3.999); and the switch() statement will work as expected. Also, you may want to add a sensorReading = clip(sensorReading, sensorMin, sensorMax) before the map() call, to make sure the output of map() is within the expected range.