void loop() {
int val = analogRead(sesePin);
val = constrain(val,750, 900);
int ledLevel = map(val, 750, 900 255, 0);
analogWrite(ledPin, ledLevel);
}
Thanks for the help! Have a great day!

Werner
Moderator: Benj
The maths isn't too bad, it just uses real numbers which can be a bit memory intensive. YOu get away with functions like this on an AVR but try them on a 8-bit PIC and you quickly eat into your RAM/ROM etc.There is something very clever about some of the Arduino functions?