Program

Setup (Start here)

Steps 1 2 3 4 5 6
Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6
Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6 7 8 9 10

Step 1

This module will cover how to create a MakeCode program for the Hummingbird Bit and how to download the program to the micro:bit.

Step 2

Insert a micro:bit into your Hummingbird Bit Controller. The Hummingbird also needs a source of power, so connect it to the battery pack or AC power adapter. Connect your micro:bit to the computer with the USB cord.

Step 3

Use this button to open the MakeCode Environment. These lessons show the Chrome browser. We recommend Chrome, but Makecode will work in most browsers. You can also go to makecode.microbit.org, click extensions, and search for the Hummingbird Bit extension.

Step 4

Minimize the micro:bit similation (the image on the left) to make more room for your programs. This similator does not work with the Hummingbird Bit.

Give your program a useful name. MakeCode will automatically save your project under this name.

Step 5

Set your browser to ask you where to download files. This will make it easier to load your programs to the micro:bit.

Step 6

To get a sense of what it is like to load a program onto the micro:bit, click the purple Download button. Select the micro:bit as the download location. By default, MakeCode will send a smiley face to your micro:bit LED screen.

Step 1

This module will show you how to use a single color LED with the Hummingbird Bit. A single color LED is a small light with two wires. The colored wire shows the color of the LED. The Hummingbird kit comes with red, green, and yellow LEDs.

Step 2

Use the terminal tool to plug an LED into LEDS port 1 on the Bit. The colored wire should be connected to ‘+’ and the black to ‘-.’

Step 3

The Hummingbird LED block is used to control a single color LED. To use this block, set the port of the LED to 1, 2 or 3 (MakeCode defaults to port 1), and set the brightness of the LED from 0% to 100%.

Step 4

The forever loop runs the Hummingbird LED block over and over. Since it sets the brightness to 100% each time, the light stays on at full brightness.

Reflect: What do you think would happen if you set the LED to 50% instead of 100%?

Step 5

Add a pause block, a second Hummingbird LED block, and a second pause block to the forever loop. The pause block stops the program for a number of milliseconds.

Step 6

Each time through the loop, the program turns the LED on, pauses, turns the LED off, and pauses again. The forever loop repeats this process over and over.

Reflect: What do you think would happen if the second pause block was not there?

Step 7

Write a program that makes the LED blink faster.

Step 1

This module will show you how to use a tri-color LED with the Hummingbird Bit. A tri-color LED is a small light with four wires. The tri-color LED actually has three tiny lights inside it. One is red, one is green, and one is blue. You can combine different amounts of red, green, and blue light to make different colors.

Step 2

Use the terminal tool to plug a tri-color LED into TRI-COLOR port 1 on the Bit. The red wire connects to ‘R,” the green to ‘G,’, the blue to ‘B,’ and the black to ‘-.’

Step 3

The Hummingbird Tri-LED block is used to control a tri-color LED. To use this block, set the port of the LED to 1 or 2 (MakeCode defaults to port 1), and the amount of red, green, and blue from 0% to 100%.

Step 4

The forever loop runs the Hummingbird Tri-LED block over and over. Since red is set to 100% each time and green and blue to 0%, the light is red.

Reflect: What do you think would happen if you set both red and blue to 100?

Step 5

Add a pause block, a second Hummingbird Tri-LED block, and a second pause block to the forever loop. The pause block stops the program for a number of milliseconds.

Step 6

Each time through the loop, the program turns the LED red, pauses, turns the LED blue, and pauses again. The forever loop repeats this process over and over.

Reflect: How can you use a tri-color LED in a robot?

Step 7

Write a program that changes the color of the LED from purple to teal to green.

Step 1

In this module, you will learn to display icons and patterns on the micro:bit screen.

Step 2

Use the micro:bit Display block to display a small picture on the screen of the micro:bit. This pattern will make a happy face.

Step 3

When the space bar is pressed, the micro:bit Display is set to the image you created. Since the display was never programmed to turn off, the image remains on the screen.

Reflect: How would you change this code to display a different image?

Step 4

Add a pause block, a second show icon block, and a second pause block to the forever loop. The pause block stops the program for a number of milliseconds.

Step 5

Each time through the loop, the program shows the first expression, pauses, shows the second expression and pauses again. The forever loop repeats this process over and over.

Reflect: How would you change the code to show 3 different expressions on the micro:bit?

Step 6

Use the show leds block to create a program that show your very own animation.

Step 1

In this module, you will learn to use the position servo. The position servo is a motor that moves to a particular angle. The Hummingbird position servo can move to any angle from 0° to 180°.

Step 2

Plug in the position servo to SERVOS port 1 on the Bit. Make sure the black wire is aligned to ‘-,’ the red wire to ‘+,’ and the white wire to ‘S.’

Step 3

The Hummingbird Position Servo block is used to control the position servo. To use this block, set the port of the servo to 1, 2, 3 or 4 (MakeCode defaults to port 1) and the angle from 0° to 180°.

Step 4

The forever loop runs the Hummingbird Position Servo block over and over, setting it to 90° each time.

Reflect: Why do you think the position servo moves once, then stops at 90°? Would the servo move if it was already at 90° before you start the program?

Step 5

Add a pause block, a second Hummingbird Position Servo block, and a second pause block to the forever loop. The pause block stops the program for a number of milliseconds.

Step 6

Each time through the loop, the program moves the servo to 90°, pauses, moves the servo to 180°, and pauses again. The forever loop repeats this process over and over.

Reflect: How would the movement of the servo change if the pause blocks were set to 300 ms instead of 1000 ms?

Step 7

Write a program that makes the servo move to 3 different positions.

Step 1

In this module, you will learn to use the rotation servo. The rotation servo is a motor that can rotate at different speeds.

Step 2

Plug in the rotation servo to SERVOS port 1 on the Bit. Make sure the black wire is aligned to ‘-,’ the red wire to ‘+,’ and the white wire to ‘S.’

Step 3

The Hummingbird Rotation Servo block is used to control the rotation servo. To use this block, set the port of the servo to 1, 2, 3, or 4 (MakeCode defaults to port 1) and the speed from -100% to 100%.

Step 4

The forever loop runs the Hummingbird Rotation Servo block over and over, setting it to 100% each time.

Reflect: What would happen if you set the speed of the Hummingbird Rotation Servo to -100% instead?

Step 5

Add a pause block, a second Hummingbird Rotation Servo block, and a second pause block to the forever loop. The pause block stops the program for a number of milliseconds.

Step 6

Each time through the loop, the program turns the motor on, pauses, turns the motor off, and pauses again. The forever loop repeats this process over and over.

Reflect: What do you think would happen if you changed the speed in the second Hummingbird Rotation Servo block to 40 instead of 0?

Step 7

Write a program that makes the servo spin counterclockwise quickly for 1 second, then clockwise slowly for 3 seconds.

Step 1

Hummingbird sensors measure different things, but they all work the same.

Hummingbird Bit base kits include a light sensor and a dial sensor, while other kits also include sound and distance sensors.

Step 2

Plug a sensor into your board. Any Hummingbird sensor can be connected to any of the three ports labelled “SENSORS” on the Bit. The yellow wire connects to ‘S,’ the red to ‘+,’ and the black to ‘-.’ The videos show a light sensor, but you can use any sensor that you want!

Step 3

To see the value of the sensor on the micro:bit LED screen, place the Hummingbird sensor block inside a show number block.

The Hummingbird sensor block is near the bottom of the Hummingbird menu in MakeCode. Use the drop-down menu to select the type of sensor that you are using.

 

Step 4

Interact with the sensor and watch the number on the micro:bit LED screen change.

Reflect: How can you make the value of the sensor higher or lower?

 

Step 5

You can use the sensor data to control the brightness of an LED.

Plug an LED into LED port 1.

Step 6

Place a Hummingbird sensor block inside a Hummingbird LED block.

Step 7

The Hummingbird sensor block measures the value of the sensor and sets the LED brightness to that value.

Reflect: In this program, the micro:bit runs the Hummingbird LED block about 40 times per second. What do you think would happen if you added a pause block to the forever loop?

Step 8

Your sensor value can be used to make decisions. To turn on an LED when the value of the sensor is low, use an if then else block from the Logic menu. This block requires a comparison block, which is also in the Logic menu.

Step 9

This program compares the value of the sensor to 10. If the sensor value is less than 10, the program runs the block inside the then section of the if then else, and the LED turns on. When the sensor value is greater than 10, the program runs the block inside the else section, turning the LED off.

Step 10

Can you make an LED turn on and off with a different sensor? Disconnect the sensor you’ve been using and connect a new sensor. Use the drop-down menu in the Hummingbird sensor block to make the block match your new sensor.