111 projek blok · Arduino · ESP32 · Pico

Pengekodan Blok untuk Projek Arduino, ESP32 dan Pico

Ikuti blok berwarna-warni dan bukannya membaca kod baris demi baris. 111 projek BlueGrays dilengkapi versi blok, dan setiap blok sepadan dengan satu baris kod sebenar yang berjalan pada papan.

Apakah pengekodan blok?

Pengekodan blok bermaksud membina program daripada blok seperti kepingan teka-teki dan bukannya menaipnya. "Tetapkan pin sebagai output", "hidupkan LED" dan "tunggu 1 saat" masing-masing ialah satu blok, dan menyusunnya membentuk program. Tiada koma bertitik, kurungan atau kesilapan menaip untuk dirisaukan, jadi kamu boleh menumpukan pada logik.

BlueGrays menggunakan set bloknya sendiri, dan blok itu bercakap dalam bahasamu: jika aplikasi dalam bahasa Melayu, blok akan menyebut "ulang selama-lamanya" dan "tulis HIGH ke pin". Dalam projek Arduino dan ESP32 blok dipetakan kepada kod C++; dalam projek Raspberry Pi Pico ia dipetakan kepada MicroPython.

Matlamatnya bukan kekal dalam blok selama-lamanya tetapi memahami kod. Letakkan blok sesuatu projek bersebelahan kodnya dan kamu dapat melihat apa yang dilakukan oleh setiap baris. Selepas beberapa projek, kamu mula membaca kod tanpa blok.

Bagaimana pengekodan blok berfungsi dalam BlueGrays

Dalam aplikasi, blok terdapat dalam bahagian kod setiap projek blok. Empat langkah:

  1. 01

    Pilih projek blok

    Projek dengan lencana blok dilengkapi versi blok. Kamu juga boleh menapis senarai untuk memaparkan projek blok sahaja.

  2. 02

    Hidupkan "Papar sebagai blok"

    Satu suis dalam bahagian kod menukar kod kepada blok. Ketik imej untuk membukanya dalam skrin penuh dan zum masuk.

  3. 03

    Fahami blok

    Tab "Fahami blok" membimbing kamu melalui program langkah demi langkah, menunjukkan hanya blok bagi setiap langkah dan fungsinya.

  4. 04

    Beralih kepada kod sebenar

    Matikan suis dan program yang sama muncul sebagai kod. Salin ke Arduino IDE (atau Thonny untuk Pico) dan muat naik ke papan kamu.

Satu program: blok dan kod

Di sebelah kiri, blok projek. Di sebelah kanan, kod yang berjalan pada papan. Setiap blok mempunyai baris kod yang sepadan.

Blok

Kod blok LED Blink
LED BlinkBuka saiz penuh

Kod

C++ (Arduino IDE)
1// ─────────────────────────────────────────
2//   BlueGrays · bluegrays.com
3//   LED Blink
4// ─────────────────────────────────────────
5// Blinks a single LED on and off every 100 ms. Shows the basic use of the
6// digitalWrite and delay functions.
7//
8// Pins:
9//   D9 -> LED (with a 220 ohm resistor)
10
11void setup() {
12  pinMode(9,OUTPUT);     // LED pin as output
13}
14
15void loop() {
16  digitalWrite(9,HIGH);  // Turn the LED on
17  delay(100);            // Wait 100 ms (1000 ms = 1 s)
18  digitalWrite(9,LOW);   // Turn the LED off
19  delay(100);
20}
21
Buka projek: LED Blink

Projek blok

Setiap projek dengan versi blok, mengikut platform. Projek percuma di hadapan: 31 daripadanya percuma sepenuhnya, termasuk blok dan kod.

Projek Arduino74 projek blok

Projek Arduino: semua projek blok

Projek ESP3223 projek blok

LED Blink with ESP32
ES-1Pemula

LED Blink with ESP32

Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

4.7(37)
108
ESP32 LED Control with Push Button (Push)
ES-2Pemula

ESP32 LED Control with Push Button (Push)

The LED lights up when the button is pressed and turns off when released. Shows how the ESP32's digital input pin and internal pull-up resistor are used. The INPUT_PULLUP mode eliminates the need for an external resistor.

4.6(36)
57
ESP32 LED Control with Pushbutton (Toggle)
ES-3Pemula

ESP32 LED Control with Pushbutton (Toggle)

Each time the button is pressed the state of the LED changes: if it is on it turns off, if it is off it turns on. Classic toggle pattern. With debounce we clean up the mechanical noise of the pushbutton to ensure a single toggle with a single press.

4.6(39)
59
ESP32 Built-in LED Blink
ES-4Pemula

ESP32 Built-in LED Blink

Blinking the built-in blue LED on the ESP32 DevKit V1. No external components required! The first project you should try when you buy an ESP32. GPIO 2 is connected to the built-in LED.

4.8(29)
54
ESP32 Traffic Light
ES-5Pemula

ESP32 Traffic Light

Real traffic light simulation with 3 LEDs red-yellow-green. Timings close to real traffic logic: red long, yellow short, green long. Classic example of sequential GPIO control.

4.4(22)
45
ESP32 Knight Rider LED
ES-6Pemula

ESP32 Knight Rider LED

6 LEDs moving sequentially from left to right and right to left (Knight Rider style). A basic example of using for loops and arrays. Teaches the logic of direction change.

4.5(19)
33
ESP32 LED Fade with PWM
ES-8Pemula

ESP32 LED Fade with PWM

Smoothly changing the brightness of the LED from 0 to max, from max to 0. We control PWM with analogWrite() as in Arduino - the same syntax as ESP32 Arduino Core 3.0+ works without problems. Pin definition + pinMode + analogWrite is enough.

4.8(36)
55
ESP32 RGB LED Control
ES-9Pemula

ESP32 RGB LED Control

Unlimited color generation with a single RGB LED instead of 3 separate LEDs. As in Arduino, we make a rainbow transition by setting the R/G/B values with analogWrite(). Color theory (such as red+green=yellow) is seen practically.

4.6(29)
52

Projek Raspberry Pi Pico10 projek blok

Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)
PI-1Pemula

Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)

The opening project of the Raspberry Pi Pico series! We blink the Pico's green built-in LED to confirm the board works, the classic "Hello World" first experiment. No external parts needed, just the Pico and a USB cable. The code is written in MicroPython, the language officially supported by the Raspberry Pi Foundation.

5.0(1)
10
Raspberry Pi Pico: Controlling an External LED (Breadboard)
PI-2Pemula

Raspberry Pi Pico: Controlling an External LED (Breadboard)

The next step after the Pico's built-in LED: connect an external LED on a breadboard and control it through pin GP14. You'll learn how to use any of the Pico's GPIO pins as an output, the LED's polarity (long leg = anode/+, short leg = cathode/–) and why a current-limiting resistor (220Ω) is a must. Without the resistor, too much current flows through the LED and it can burn out.

4.5(2)
7
Raspberry Pi Pico Alternating Two LEDs (Blink-Flip Pattern)
PI-3Pemula

Raspberry Pi Pico Alternating Two LEDs (Blink-Flip Pattern)

The next step after the Pico's single LED: the classic flip-flop animation, with two LEDs blinking in turn. One LED turns off as the other turns on, the most basic example of handling multiple GPIOs. Two LEDs of different colors (red on GP14, green on GP13) swap every 500 ms. With MicroPython's Pin.toggle() method, the code stays short and readable.

5.0(2)
19
Raspberry Pi Pico Traffic Light Simulator (3 LEDs Sequential)
PI-4Pemula

Raspberry Pi Pico Traffic Light Simulator (3 LEDs Sequential)

We recreate real traffic light logic with red, yellow and green LEDs, the first Pico project to move up to 3 LEDs! Green says "go" for 4 seconds, yellow "get ready" for 1.5 seconds, red "stop" for 3 seconds, and red+yellow "set off" for 1 second (the European traffic light pattern). You'll learn to define functions (def all_off()), state machine logic and multi-GPIO synchronization.

4.0(1)
12
Raspberry Pi Pico Police Strobe Light Effect (Red + Blue)
PI-5Pemula

Raspberry Pi Pico Police Strobe Light Effect (Red + Blue)

We simulate a police car's light bar with a Raspberry Pi Pico in its simplest form! The red and blue LEDs take turns (flip-flop): while red is on, blue is off, and they swap every 0.3 seconds, forever. The code writes the two steps directly in a single while True loop; the speed is set with the WAIT_MS constant.

4.7(3)
10
Raspberry Pi Pico 3-Burst Police Flip-Flop (2 LEDs)
PI-6Pemula

Raspberry Pi Pico 3-Burst Police Flip-Flop (2 LEDs)

Rhythmic variation of the police strobe project — 3-burst flip-flop! Same 2-LED circuit (GP11 red + GP12 blue), but a different pattern: red LED flashes 3 times rapidly, then blue flashes 3 times, forever. This "burst + switch" pattern is the most recognizable rhythm of real police siren lights. Learn parametrized function def burst(led, count, duration_ms), rhythm design, and generating different visual effects with code on same circuit.

5.0(1)
16
Raspberry Pi Pico Button Toggle LED
PI-10Pemula

Raspberry Pi Pico Button Toggle LED

Button + LED — next level! Unlike the basic button project, there is no need to hold the button. Press and release → LED on. Press and release again → LED off (toggle). Same circuit (LED GP14, Button GP2), but big code difference. Learn edge detection (capturing the 1→0 falling moment), state tracking, debounce (mechanical bounce filter). MicroPython's led.toggle() swaps state in one line. Foundation of all interactive button projects (mode switcher, IRQ, double-click).

10
Raspberry Pi Pico PWM LED Fade (Breathing Effect)
PI-14Pemula

Raspberry Pi Pico PWM LED Fade (Breathing Effect)

The LED doesn't just blink anymore, it breathes! With the Raspberry Pi Pico's PWM (Pulse Width Modulation), the LED's brightness slowly rises and then slowly fades, a calm "breathing" effect like a sleeping laptop's light. You'll learn the machine.PWM class, the 16-bit brightness value from 0–65535 with duty_u16() and the PWM frequency.

4

Untuk siapa?

Kanak-kanak dan ibu bapa

Pengekodan untuk kanak-kanak lebih melekat jika berakhir dengan LED yang menyala di atas meja. Blok menjadikan program mudah dibaca, dan kamu membina litar bersama-sama.

Guru dan kelab

Dalam kelas robotik atau STEM kamu boleh menerangkan projek dengan blok dahulu, kemudian beralih kepada kodnya. Setiap projek mempunyai senarai komponen dan gambar rajah litar yang sedia ada.

Pemula

Pengekodan blok Arduino ialah cara terpantas untuk memahami logik dalam beberapa projek pertama kamu. Mulakan dengan blok dan beralih kepada kod apabila kamu rasa bersedia.

Soalan lazim

Apakah pengekodan berasaskan blok?

Ia ialah cara pengaturcaraan yang arahannya dipaparkan sebagai blok yang disambung seperti kepingan teka-teki dan bukannya teks yang ditaip. Oleh kerana kesilapan menaip tidak mungkin berlaku, pemula dan kanak-kanak lebih mudah memahami logik sesuatu program.

Berapa banyak projek BlueGrays yang dilengkapi blok?

Buat masa ini 111: 76 projek Arduino, 25 ESP32 dan 10 Raspberry Pi Pico. Senarai bertambah apabila lebih banyak projek ditukar.

Adakah pengekodan blok percuma?

Aplikasi ini percuma. Blok dan kod 31 projek blok terbuka kepada semua orang. Dalam projek lain, blok dibuka dengan Premium, sama seperti kod.

Bolehkah saya memuat naik blok terus ke papan saya?

Tidak. Blok menjadikan program lebih mudah dibaca dan difahami; apa yang masuk ke papan sentiasa kod sebenar projek itu. Kamu menyalinnya ke Arduino IDE, atau Thonny untuk Pico, dan memuat naiknya.

Bolehkah saya membina program sendiri dengan blok?

Belum lagi. Kami menyediakan blok untuk setiap projek dan memadankannya dengan kod satu lawan satu, jadi blok yang kamu lihat sentiasa mewakili program yang telah diuji dan berfungsi.

Apakah bezanya dengan Scratch atau mBlock?

Dalam Scratch dan mBlock kamu menyeret blok pada komputer untuk menulis program sendiri. Dalam BlueGrays setiap projek blok dilengkapi gambar rajah litar, senarai komponen dan kod sebenar, dan blok ialah versi kod itu yang mudah dibaca. Kedua-duanya saling melengkapi.

Adakah sesuai untuk kanak-kanak? Pada umur berapa mereka boleh bermula?

Kanak-kanak sekitar 9 atau 10 tahun yang boleh membaca dengan baik boleh bermula bersama orang dewasa. Projek pertama tidak memerlukan pateri: ia dibina pada breadboard dengan LED, butang dan buzzer.

Dalam bahasa apakah blok itu?

Bahasa Inggeris, Turki, Jerman, Sepanyol, Perancis dan Itali, termasuk Melayu. Blok dipaparkan dalam bahasa yang kamu gunakan untuk aplikasi.

Aplikasi BlueGrays

Mulakan pengekodan blok pada telefon kamu

Blok, gambar rajah litar, senarai komponen dan kod sebenar pada satu skrin. Percuma di iOS dan Android.

Muat turun di App StoreDapatkan di Google Play

Halaman platform