Maximum value of the analogWrite() function

Why is the maximum possible value of the analogWrite() function 255 starting from 0?

Because our module can write upto 256 bits(0 to 255) i.e 2^8


But how come the light monitoring system can show data values from 0 upto 1023(1.02thousand) ,i.e., 2^10?

In arduino, ADC(analogRead) is 10bit and PWM timer (analogWrite) is 8 bit. may be this device also come with 10 bit ADC and 8 bit PWM timer. so when we convert 10 bit it become 0-1023. Please someone clarify

1 Like

@karthikcakuttu your reason seems pluasible but clarification is needed

@A.K.N For your clarification…ADC can support upto 10 bits while PWM can support upto 14 bits

I think the data in the photos are for the ESP8266EX model, but the model we got is ESP8266 only

analogWrite() function is for A0 pin which is a 8 bit pin and total range can be found using the formula
2^8 =256 (it can take 256 values)and since we start from 0 so last value will be 255.