Introduction
What is MicroBlocks
- MicroBlocks is a free programming environment that allows working with different boards (Citilab ED1, micro:bit, M5Stack, ESP32 STEAMaker, etc.).
- The code is visualized on the computer but executed directly on the board. This means that it can be disconnected and continue to function without any additional operation.
- It is available both to install on different systems (Windows, MacOS, Linux) and to use it online.
Features ED1 (Front)
Features ED1 (Back)
Installation and connection with board
- Download the program directly from here or go to the web version (a recent version of Chrome or compatible is required).
- With some boards you need to install a driver in case the system does not detect the board automatically. In the case of the ED1, this driver is needed.
- Once the computer detects it, the program should automatically connect to the board. In the web version, the connection must be made manually by clicking on the corresponding icon.
Blocks and libraries
Like many block programming environments, we have a palette of blocks divided into categories.
We also have a number of libraries available, which are collections of blocks with a single purpose. Some of these are made up of other blocks.
By default, the program will load some libraries or others depending on the board connected.
1. First steps
1.1 - Let's start programming
- We will start by using the screen block of LED Screen by taking it and dragging it to the programming area.
- We will also take the starting block from the control category and connect it to the previous one.
- Click on the start button to see how it works.
- Unplug the board, turning it off and on to check that the program has indeed been saved on it.
Challenge 1: Try making other drawings with the screen block!
Solution to Challenge 1
1.2 Iterations (I)
- If we want to repeat an action several times, for example making a drawing change to perform an animation, we can use the iteration blocks like “forever” or “repeat _ times” ( among others) that we have in Control.
- You will also need to wait a little between the blocks to give time to visualize the changes on the screen, otherwise it will happen too quickly and you won't be able to appreciate it.
Challenge 2: Try to make an animation that repeats continuously with the previous blocks
Solution to challenge 2
1.3 Iterations (II)
- There are other repetition blocks that are also very useful, such as the “repeat until _” and the “for every and in _”.
- In the first, the repetition is repeated until a condition occurs, for example if we press a button on the board.
- In the case of the second, the value of i will start at 1 and will grow at each iteration until reaching the established value (by default 10). It is also used to iterate through lists, as we will see later.
Challenge 3: Try to do an integer count from 5 to 0 with a repeat block.
Solution to challenge 3
1.4 - Buttons and conditionals
For this board we have a library available to use the buttons. If it is not loaded automatically, we can add it by clicking on the + symbol (Add Library) and going to Other > ED1 Buttons.ubl.
Buttons return a digital value (true or false) represented as a green or red switch. This type of block can be inserted into any other block that has the slot represented in the same way.
Challenge 4: Show a drawing on the screen and clear it using two buttons.
Solution to challenge 4 (when)
Solution to challenge 4 (forever)
Next activity ➡️ |
---|
© by Citilab Edutec 2019-2022.
This work is licensed under a CC-BY-SA 4.0 license.