void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(2,INPUT);
pinMode(14,OUTPUT);
}
void loop() {
int v=analogRead(2);
int intensity = map(v,0,4095,0,255);
analogWrite(14,intensity);
Serial.println("Read value: " +String(v)); //0 to 4095
Serial.println("Intensity value" +String(intensity)); //0 to 255
delay(1000); // this speeds up the simulation
}