Coordinates


What are we going to do?

In this activity we are going to learn a bit more bout micro:bit led matrix. In this activity, students will create programs using coordinates and LEDs. Each of these short exercises demonstrates how to use coordinates to control the LEDs. These programs can then be modified and used in the students’ more complex projects.

Objectives:

  • Understand that the 5 x 5 grid of LEDs on the micro:bit represents a coordinate grid with the origin (0,0) in the top left corner.
  • Understand that the values of the x coordinates range from 0 through four and increase from left to right.
  • Understand that the values of the y coordinates range from 0 through four and increase from top to bottom.
  • Learn how to refer to an individual LED by its X and Y coordinates.
  • Learn how to plot (turn on) and unplot (turn off) individual LEDs and how to toggle between these two states.

This activity has two parts:

  • Smile animation - A short exercise in plotting and toggling LEDs to create a simple animation.
  • Brightness - A short exercise in using the brightness settings for the micro:bit LEDs.

Materials

micro:bit board

The micro:bit was designed to be classroom-friendly from day one. More approachable than just coding, it's a great way to achieve fun, practical results with motivated students. Buy from here starter kit (recommended) or board only.

micro USB cable

If your micro:bit board didn't came with a USB cable, any microUSB cable should do the trick

Computer

The code editor is web based, so any computer with a web browser (and Internet connectivity) will do

Instructions

1 Open editor

Once you've opened the editor, pick a name for your project. Remember that it should be something that easily identifies it. To create a program, you just have to select some blocks from the left side of your page and drag and drop them to your workspace.

Click to zoom

2.1 Code: Animation

From the list of possible blocks, choose the ones needed to code something like the picture below. You can test your program with the simulator on the left of the screen. Once you're happy with the result, click on "Download".

Click to zoom

2.2 Code: Brightness

From the list of possible blocks, choose the ones needed to code something like the picture below. You can test your program with the simulator on the left of the screen. Once you're happy with the result, click on "Download".

Click to zoom

3 Upload to the board

When the program is ready and you click "Download", an HEX file will be downloaded to your computer (normally to your download folder). If download succeeded, a message will appear on your screen. Click "done".

Now, connect your micro:bit board to your computer using the micro USB cable. Your computer should now detect your micro:bit just as if it was an external drive. Search the HEX file you just downloaded and drag and drop them on your micro:bit drive. On windows you can right button on the HEX file and click send to MICROBIT.

Click to zoom

4 Final result

After a few seconds, your program should start on your micro:bit board.

Congratulations, you're on the right path to be a maker!, now continue with the following challenges! 🙂

Now it's your turn!

Now it's time to start coding on your own! Do you accept these challenges?

Smile animation activity:

  • Add a third image to the animation, perhaps a frown face.
  • Make your own custom animation! What LEDs stay the same and which need to be toggled?

Brightness

  • Try changing the 25 to 10 or 15, what happens?
  • Add another icon and make one fade away, then make the other fade in.

What else?

Now that you know how coordinates work, you can try to make animations or even a simple game like this one: dodge ball game. You just have to download it and send it to your micro:bit board.

Important! When using coordinates remember micro:bit's coordinates layout:

microbit-led-coords


Continue your maker journey with the next activity: Radio communication

or return to maker workshop main page