More LED Control

More LED Blocks

If you click on the LED code category, you will see the '...more' option. This provides access to even more LED control blocks.

We can use these to provide even more control over the LEDs.


The Set Brightness block changes the brightness of all the LEDS.

255 is maximum brightness, 0 is off.

The Program below shows how we can use the 'set brightness' block to change the brightness of the LEDs when we press the buttons.

Press A or B to change the brightness of the LEDs

How to Change the brightness of the LEDs

Watch the video below to see how to change the brightness of the LEDs

MoreLED.mp4

Press A or B to change the brightness of the LEDs

Challenges

Heart

Create a program that when you press the A button, a heart will show on the LEDs which will fade and get brighter.

  • When you press the A button the LEDs should display a heart
  • a loop that repeats forever should start. Inside the Loop:
    • Use set brightness to 255. This is maximum brightness.
    • Add a pause.
    • Now set its brightness to about half of that value and add another pause.


Press the A button

Beating Heart

Change the previous program so that it looks like the heart is beating.

Press the A button