Zum Inhalt springen

Projekte

#1 Blink Project With micro:bit

von PicoBricks Team 14 Apr 2025

An employee starting a new job in real life usually takes on the most basic tasks. A janitor learns to use a broom, a chef learns kitchen utensils, and a waiter learns tray carrying. We can multiply these examples. The first code written by those who are new to software development is generally known as "Hello World." The language they use prints "Hello World" to the screen or console window when the program starts, marking the initial step in programming. It's akin to a baby starting to crawl... The first step in robotic coding, also known as physical programming, is the Blink application. In robotic coding, blinking symbolizes a significant moment. Simply by connecting an LED to the circuit board and coding it, the LED can be made to continuously blink. Ask individuals who have developed themselves in the field of robotic coding how they reached this level. The answer they will give you typically starts with: "It all began with lighting up an LED!"

LEDs and screens are electronic circuit components that provide visual output. Thanks to output elements, a programmer can concretely determine at which stage their code is progressing. With PicoBricks, Micro:Bit includes 25 LEDs (5x5 Matrix) and a 128x64 OLED screen. When starting robotic coding with PicoBricks, printing "Hello World" on the OLED screen and winking with matrix LEDs are equally straightforward.

Connection Diagram:

You can prepare this project without making any wiring connections.

Project Images


MakeCode Code of The Project:

If you have completed the PicoBricks - MakeCode connection and add-on installation steps, the coding steps to follow for the first project are detailed in the visual below. 


Python Code of The Project:

#Blink Project
from microbit import *
from picobricks import *

# Function Initialization
oled = SSD1306()
oled.init()
oled.clear()
oled.add_text(0,0,"Hello World")

#smile images
pb_smile = [
    [1, 1, 0, 1, 1],
    [1, 1, 0, 1, 1],
    [0, 0, 0, 0, 0],
    [1, 0, 0, 0, 1],
    [0, 1, 1, 1, 0],
]
#blink images
pb_blink = [
    [1, 1, 0, 0, 0],
    [1, 1, 0, 1, 1],
    [0, 0, 0, 0, 0],
    [1, 0, 0, 0, 1],
    [0, 1, 1, 1, 0],
]

while True:
    for y in range(5):
        for x in range(5):
            if pb_blink[y][x] == 1:
                display.set_pixel(x, y, 9)
            else:
                display.set_pixel(x, y, 0)
    sleep(500)
    for y in range(5):
        for x in range(5):
            if pb_smile[y][x] == 1:
                display.set_pixel(x, y, 9)
            else:
                display.set_pixel(x, y, 0)
    sleep(500)

MicroBlocks Code of The Project:

Vorheriger Beitrag
Nächster Beitrag

Danke fürs Abonnieren!

Diese E-Mail wurde registriert!

Shoppen Sie den Look
Wählen Sie Optionen

Bearbeitungsoption

Benachrichtigung wieder auf Lager

Vergleichen

Produkt ArtikelnummerBewertungBeschreibung Sammlung Verfügbarkeit Produktart Andere Details
this is just a warning
Anmeldung
Einkaufswagen
0 Artikel
Same Day Shipping No Extra Costs
Easy Returns Guarantee Return with Ease
Secure Checkout Secure Payment