Lab: Flashing an RGB LED RGBMYCW

header-lesson-04

Lab: Flashing an RGB LED RGBMYCW#

Objective:#

In this lab, you will flash an RGB LED red, green, blue, magenta, yellow, cyan, and white.

Materials:#

  • 1 PC or Laptop

  • 1 BBC micro:bit

  • 1 Micro USB cable

  • 1 common cathode RGB LED

  • 3 47Ω resistors (yellow, violet, black, golden)

  • 4 male-to-female jumper wires (can match the colors of the LEDs, and GND)

  • 1 Kitronik prototyping plate (micro:bit breakout board and breadboard)

Instructions:#

  1. Setup: Connect your BBC micro:bit to your PC or laptop using the Micro USB cable. Place it into the Kitronik prototyping breakout board.

  2. Programming Environment: Open the BBC micro:bit programming environment on your PC or laptop.

  3. Build your Circuit:

    • Place the RGB LED in the breadboard.

    • Add the resistors to the proper leads of the RGB LED. (Remember that the longer lead is attached to GND or 0V).

    • Attach the resistors.

    • Connect the components to the Kitronik prototyping breakout board.

  4. Code your device: Using the MakeCode editor, write code to control your device.

    • Think of the sequence you want to flash red, green, blue, magenta, yellow, cyan and white:

    • What are the values needed?

    • Do you want to use functions?

    • What is the duration you want the different colors to stay on?

    • Write code to reflect the values.

  5. Test your device: After you’ve written your code, download it to your micro:bit and test your device. Make sure all the colors are flashing (red, green, blue, magenta, yellow, cyan and white). The sequence the colors flash is not important. Just make sure it matches the sequence you deternined.

  6. Document your work: Take pictures or videos of RGB LED flashing the different colors. Write a brief report explaining your design process, how you coded your device, any challenges you faced, and how you overcame them. How might you apply a system like this in the real world?

  7. Present your work: Prepare a short presentation to share your flashing LED with the class. How might you apply a system like this in the real world?

  8. Reflection: Write a brief report explaining the logic behind your code.