# Intensity of led

when we use digitalwrite function to switch on the led at what intensity does the led glow?

The gpio pin of BOLT wifi module gives a voltage of 3.3V at high state, the same voltage is given when we use digitalwrite function to turn on the LED.

The intensity of the LED depends on the voltage across the LED which in turn depends on value of the resistor used in series with LED, As the value of resistor increases, intensity of LED decreases and vice-versa.

Because as the value of resistor increases voltage drop across the resistor increases and voltage across LED decreases. We can verify the same using voltage divider rule.

so does that mean that the given intensity range in the tuiorials of 0-255 is for a particular resistor value? if yes what is that resistor value, if not then how does digitalwrite intensity depend on the resistor value?

I think you are talking about “analogwrite” function, “digitalwrite” function takes only two values i.e., ‘HIGH’ or ‘LOW’. “digitalwrite” function gives 0V for LOW and 3.3V for HIGH in BOLT wifi module.

“analogwrite” function takes values from 0 to 255. In this if the value is 0 that means the LED would be OFF, and 255 means the LED would be at its maximum intensity i.e., the intensity goes on increase with increase in the value from 0 and gives maximum intensity for 255.

This is achieved using Pulse Width Modulation(PWM). It is the technique where the width of digital pulses is adjusted to generate different average DC voltages, So by changing the values you change the width of the pulse in the pin in turn changing the average DC voltage. All the digital GPIO pins in BOLT wifi module support PWM.