// A program to demonstrate the map() function.
//The pin where our sensor is attached.
const byte sensorPin = A0;
void setup(){
//Serial port setup
Serial.begin(9600);
}
void loop() {
// Read the value from the analog pin
int rawData = analogRead(sensorPin);
// Mapping the value
byte mappedData = map(rawData, 0, 1023, 0, 4);
Serial.print("mapped Sensor Reading = ");
Serial.println(mappedData);
}