Playing with LEDs

Playing with LEDs

von Citilab Edutec

Boards
Boards:

Citilab ED1

Component/s
Weitere Komponenten:

LED
This activity is part of the Citilab Course. Check it out!

Playing with LEDs

LEDs

  • An LED (Light Emitting Diode) is a device that emits light when an electric current passes through.

  • LED

  • There are several types of LEDs, with different sizes and colors. There are even some that can light up with any color (RGB).

  • There are also RGB LED strips that are widely used for home automation and lighting in public places.

    Various LEDs RGB LED

Connecting the LED

  • Connecting the LED to the board is done in a similar way to the potentiometer, but in this case we will use the digital pins instead of the analog ones.

LED Connection

  • The colors of the cables and pins must be respected, otherwise the LED will not light up.

  • To test how it turns on and off, we will use the block set digital pin _ to _, while changing the state of the logic switch.

set digital pin block

Challenge 1: try to create a program that makes the blinking effect (blink) with the LED

Challenge

Solution to challenge 1

Challenge 2: Make the blinking effect faster or slower depending on the value read from the potentiometer

Challenge

Solution to challenge 2

Brightness control

  • MicroBlocks allows analog values ​​to be used on digital pins, so we can manipulate the level of light emitted by the LED.

  • For this we will use the block set pin _ to _ that we will find in the Pins category.

set analog pin block

  • As the range of values ​​is the same for the inputs as for the analog outputs, we can insert the analog reading block directly inside the previous one.

set analog pin block

Challenge 3: Make the LED turn on gradually, like a beacon or a visual alarm.

Hint: Use a variable to control the brightness.

Challenge

Solution to challenge 3

CC-BY-SA

© von Citilab Edutec 2019-2022.
This work is licensed under a CC-BY-SA 4.0 license.