#5 RGB LED Control Panel Project With micro:bit
In these days, RGB LEDs, used in various areas such as billboards, traffic lights, warning signs, etc., have a fundamental feature of being able to obtain intermediate colors by taking values between 0-255 for red, green, and blue colours. In fact, with RGB LEDs, we can create animations by changing colors on a panel we create.
There are three RGB LEDs on PicoBricks. By using the MakeCode editor, we can obtain various color outputs by setting the desired RGB values for each of these RGB LEDs. In this project, we will examine in detail how RGB LEDs work by changing color values with the potentiometer module and buttons.
Using the PicoBricks potentiometer module, we will adjust color values between 0-255. By pressing the button on the PicoBricks Potentiometer & Button module, we will set the color value to red; by pressing Micro:Bit A button, we will set it to green, and by pressing Micro:Bit B button, we will set it to blue. This way, we will observe the instant changes in the values of the three RGB LEDs on the PicoBricks RGB LED module. At the same time, the color values will be updated on the PicoBricks OLED screen each time we press a button.
Connection Diagram:
You can prepare this project without making any cable connections.

Project Images:
![]() |
![]() |
![]() |
MakeCode Code of The Project
Python Code of The Project:
#RGB LED Control Panel Projects from microbit import * from picobricks import * import neopixel # Pin Initialization RGB_Pin = pin8 Num_Leds = 3 Pot_Pin = pin1 Button_Pin = pin2 # Function Initialization oled = SSD1306() oled.init() oled.clear() np = neopixel.NeoPixel(RGB_Pin, Num_Leds) #Neopixel np[0] = (0, 0, 0) np[1] = (0, 0, 0) np[2] = (0, 0, 0) np.show() pot_value=0 counter=0 r=0 g=0 b=0 while True: oldpot=pot_value pot_value = round(round( Pot_Pin.read_analog() - 0 ) * ( 255 - 0 ) / ( 1023 - 0 ) + 0) if oldpot!=pot_value: oled.add_text(5,3," ") oled.add_text(5,3,str(int(pot_value))) oled.add_text(1,0,"R __ G __ B") button = Button_Pin.read_digital() if button==1: display.show('R') o_r= r r = pot_value if o_r != r: oled.add_text(1,2," ") oled.add_text(1,2,str(int(pot_value))) if button_a.is_pressed(): display.show('G') o_g=g g=pot_value if o_g==g: oled.add_text(5,2," ") oled.add_text(5,2,str(int(pot_value))) if button_b.is_pressed(): display.show('B') o_b=b b=pot_value if o_b==b: oled.add_text(9,2," ") oled.add_text(9,2,str(int(pot_value))) #Neopixel np[0] = (r, g, b) np[1] = (r, g, b) np[2] = (r, g, b) np.show()