First steps

First steps

来自 Citilab Edutec

Boards
主板:

Citilab ED1

Component/s
配件:

无需配件
This activity is part of the Citilab Course. Check it out!

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.

The same block on different boards

Features ED1 (Front)

ED1 front view

Features ED1 (Back)

ED1 back view

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.
USB browser connection USB connection indicator

Blocks and libraries

Like many block programming environments, we have a palette of blocks divided into categories.

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.

Libraries

By default, the program will load some libraries or others depending on the board connected.

Default Libraries

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.

Let's start programming

Challenge 1: Try making other drawings with the screen block!

Challenge accepted

Solution to Challenge 1 Solution 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.

forever and repeat blocks

  • 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.

Wait block

Challenge 2: Try to make an animation that repeats continuously with the previous blocks

Challenge accepted

Solution to challenge 2 Solution challenge 3

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.

repeat until block

  • 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.

for i in block

Challenge 3: Try to do an integer count from 5 to 0 with a repeat block.

Challenge accepted

Solution to challenge 3 Solution 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.

    ED1 buttons library

  • 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.

False True

Challenge 4: Show a drawing on the screen and clear it using two buttons.

Challenge

Solution to challenge 4 (when)

Solution to challenge 4 (forever)

This activity is part of the Citilab Course.

Next activity ➡️

CC-BY-SA

© 来自 Citilab Edutec 2019-2022.
This work is licensed under a CC-BY-SA 4.0 license.