MicroBlocks-Pico:ed v2 Quick Start
This tutorial will introduce you to the way you can programmatically interact with Pico:ed v2 on the MicroBlocks platform.
MicroBlocks is an open graphical programming platform that allows you to learn programming while interacting with your microcontroller. Although MicroBlocks is just one of many graphical programming platforms, what really makes MicroBlocks stand out is its combination of real-time compilation and autonomous operation.
Its excellent features are listed below:
- MicroBlocks is a real-time programming environment, no need to wait for the program to be compiled and downloaded, just click on the code block and see the result instantly.
- MicroBlocks Individual scripts can be written for each component and run simultaneously.
- MicroBlocks can run on a wide range of microcontroller motherboards, and it groups components with the same function on different machines and controls them in the same programming way, so the code you write is highly portable.
- You can read the programs in the microcontroller's motherboard for your easy access and sharing.
For more information about MicroBlocks programming platform, you can visit its official website: MicroBlocks official website.
First, you need to open the MicroBlocks official website in your computer browser and click the "Run" button in the upper right corner to enter the graphical programming interface.
Click on the small gear icon in the upper left corner of the MicroBlocks programming platform screen, select the "updata firmware on board" option from the drop-down options, and select "Elecfreaks Pico:ed" firmware.
According to the pop-up window that appears, first you need to press the "BOOTSEL" button on the back of the Pico:ed v2 ( where ① is the BOOTSEL button and ② is the RESET button), and connect the Pico:ed v2 to your computer using the USB cable, then click the "OK" button on the MicroBlocks platform pop-up window to save the driver to the "RPI-RP2" disk.
After the above steps, you have finished burning the driver of Pico:ed v2 in MicroBlocks platform, you still need to connect MicroBlocks platform with Pico:ed v2 before you start programming. Click on the USB cable female icon in the menu bar, click on the "connect" option, and in the pop-up window, select "PicoArduino", (*COM19 is the recognized port number of this computer, the number shown on your computer may be different to the one shown on your computer). Then click "connect" you can see the menu bar USB cable female icon has a green background, which proves that it has been successfully connected, then you can enter the programming world happily.
Next, we will learn to program the interaction of each programmable component on the Pico:ed v2 board, such as the A/B buttons, the 7*17 LED screen, the buzzer, the gold finger pins, and the LED indicator (pin number 25) that is unique to the Pico:ed v2. Let's get started.
Light up the Pico:ed v2 logo indicator
Tap on the "Output" block library in the left block library menu, drag the "set user LED " block to the right edit area, the "set user LED" block has two modes(on/off) corresponding to the Pico:ed v2 on-board LEDs(on/off), see them in the figure below:
Tip: To program in MicroBlocks platform, you don't need to download the program, just click on the blocks you have dragged to the editing area and you can see the running effect.
Light up the Pico:ed v2 LED light matrix screen
To program the Pico:ed v2 LED light matrix screen you need to add the " TFT" library, click on the "Libraries" right side of the "+ ", select "Graphics" from the options that appear, then double click on the "TFT" library, or click on "Open " and you're done adding the TFT library to it.
Lights up each LED on the 7*17 LED matrix screen
The MicroBlocks platform defines the coordinates of the LEDs in the upper left corner of the Pico:ed v2 7*17 LED matrix screen as zero (0, 0) and the coordinates of the LEDs in the lower right corner as (16, 6). You can use the "set TFT pixel x()y()to()" block to light up or light down each LED.
Examples are as follows:
There are also blocks for drawing shapes in the TFT block library, so you can try them out. Here is a very interesting case for reference:
A/B key programming
Programming key interactions is relatively easy to learn. You can use the following commands directly from the "Control" and "Input" building blocks library.
An example of A/B key programming is as follows.
To program the buzzer, you need to add the "Ringtone" block library and the "Tone" block library. As shown in the figure below.
The "Ringtone" block in the "play ringtone" library allows you to compose ringtones, so you can try to compose the ringtone you want. If you are looking for already written ringtones, the website link below has a collection of nearly 10,000 ringtones for you to choose from.
The "Tone" block library allows you to set how long to play a specific note, and also how often to play it, etc.
An example of how the buzzer is programmed is as follows.
Programming the Pico:ed v2 pins
Next we will use the Pico:ed Starter Kit to demonstrate the control of LEDs on the MicroBlocks platform using the Pico:ed v2 gold finger pins. This example can also be reproduced if you have alligator wires, leds, 100Ω resistors and other components.
Pico:ed Starter Kit purchasing link: Pico:ed Starter Kit .
Connect your components according to the following pictures.
connect the short pin of the LED to GND.
Connect the long pin of the LED to the P0 and P1 ports through a resistor.
After the connection is completed, the picture is as follows.
The Pico:ed v2 pin programming demonstration case is programmed as follows.
The above is a simple demonstration of how Pico:ed v2 is programmed in MicroBlocks platform, you can explore more interesting and fun programming cases, of course, we also welcome you to share the cases to us, the following is our official media account, we will update the interesting cases, welcome to follow and participate in the discussion:
Official web: https://shop.elecfreaks.com