> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/wokwi/wokwi-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LED

> Standard 5mm LED with configurable color and brightness

Standard 5mm LED.

## Pin names

<ParamField path="A" type="pin">
  Anode (positive pin)
</ParamField>

<ParamField path="C" type="pin">
  Cathode (negative pin)
</ParamField>

## Attributes

<ParamField path="color" type="string" default="red">
  The color of the LED body
</ParamField>

<ParamField path="lightColor" type="string" default="depends on color">
  The color of the light
</ParamField>

<ParamField path="label" type="string" default="">
  Text that appears below the LED
</ParamField>

<ParamField path="gamma" type="string" default="2.8">
  Gamma correction factor
</ParamField>

<ParamField path="flip" type="string" default="">
  Flips the LED horizontally
</ParamField>

<ParamField path="fps" type="string" default="80">
  The framerate of the LED
</ParamField>

<Note>
  To rotate LEDs, click on them and press "R", or set the "rotate" property in the diagram format.
</Note>

### Gamma correction

The LED automatically applies gamma correction. This means that even a very short burst of current will result in some visible light, similar to how physical LEDs work, so you get more accurate simulation in the following cases:

1. Using `analogWrite()` with very small values (short duty cycle),
2. LED scanning techniques such as [Charlieplexing](https://goodarduinocode.com/guides/charlieplexing).

You can disable the gamma correction by setting the "gamma" attribute to "1.0". You can also choose a different gamma factor by setting this attribute to the desired value. The default gamma correction factor is 2.8.

The [Gamma Correction Demo project](https://wokwi.com/projects/304762988710068800) shows the behavior of different gamma values: the LED on the left has the default gamma factor of 2.8, while the LED on the right has a gamma factor of 1.0. You can see how lower values of `analogWrite()` look much brighter on the left LED.

For more information about *gamma correction*, including some code examples, check out this [great guide from Adafruit](https://learn.adafruit.com/led-tricks-gamma-correction).

### FPS

The `fps` attribute controls the framerate of the LED, that is how often the LED brightness is updated. The default value is 80.

If you are using PWM (`analogWrite()`) and noticing flickering, try setting a smaller the `fps` value.

In case you are experiencing LED light ghosting, you can try increasing the `fps` value. For example, this [rotating cube](https://wokwi.com/projects/355020415991153665) uses an `fps` value of 10000 to update the LEDs at a higher rate and avoid ghosting of the rotating cube.

## Simulator examples

* [Blink](https://wokwi.com/projects/344891652101374548) - Arduino's standard Blink sketch
* [Fade](https://wokwi.com/projects/313268562698437186) - Using analogWrite() + gamma correction
