https://itp.nyu.edu/physcomp/lessons/variables/
the analog to digital converter (analogRead) is a ten-bit device 1023, and the PWM timer (analogWrite) is an eight-bit 255.
The output from analogRead()
can’t fit in a single byte because the microcontroller’s analog-to-digital converter (ADC) reads the input with a resolution of 10 bits, or 210. To get the output into a single byte, map the output to a range from 0-255.