Print

Hummingbird Bit: Snap! Lessons

Setup with Bluetooth (Mac/Windows)

Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6 7 8 9 10
Steps 1 2 3 4 5
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
Steps 1 2 3 4 5 6 7 8 9
Steps 1 2 3 4 5 6 7 8 9
Steps 1 2 3 4 5 6 7 8 9
Steps 1 2 3 4 5 6 7 8 9
Steps 1 2 3 4 5 6 7
Steps 1 2 3 4 5 6 7 8 9 10
Steps 1 2 3 4 5 6 7 8 9
Steps 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Steps 1 2 3 4 5 6 7 8 9 10

Setup with Bluetooth (Mac/Windows)

This module will cover how to connect to the Hummingbird Bit via Bluetooth and start programming in Snap!.

For Windows and pre-2014 Macs, you will need a Bluetooth dongle to use Hummingbird Bit with Snap! via Bluetooth.

Using a Chromebook? Setup your Hummingbird Bit here.

Don’t have a Bluetooth dongle? Setup your Hummingbird Bit here.

Please note that there is no sound in these videos.

Insert a micro:bit into your Hummingbird Bit Controller (you might need to push a little harder than you think!), and connect it to the computer with the USB cord. The Hummingbird also needs a source of power, so connect it to the battery pack or AC power adapter.

Download this file and drag it onto the micro:bit. Your device should start to flash three letters on its display.

Download Hex File

Remove the USB cord. You won’t need it to use Snap!

Insert the bluetooth dongle into a USB port.

Open the BlueBird Connector and check that the bluetooth symbol has a green check beside it.

You may see one robot or many, depending on how many are nearby.

Click on the name of the robot that matches the initials on your device.

You will hear a sound as your device connects, and the initials will stop flashing on the device. The name of your robot should appear under Connected.

Troubleshooting Note: The BlueBird Connector must remain open in the background the entire time that you are working with the Hummingbird. If your Hummingbird disconnects, the app will notify you, and the Hummingbird will begin flashing its initials again. If this happens, return to the BlueBird Connector and reconnect it.

You are ready to begin programming! Click Open Snap!.

Setup with Bluetooth (Chromebooks)

This module will cover how to connect, charge, and start programming your Hummingbird Bit via Bluetooth, using a Chromebook and Snap! as the programming language.

Note: Programs written in Snap! using the BlueBird Connector for Mac/Windows cannot be run on a Chromebook, and vice versa.

Insert a micro:bit into your Hummingbird Bit Controller (you might need to push a little harder than you think!). 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.

Download this file and drag it onto the micro:bit. Your device should start to flash three letters on its display.

Download Hex File

Remove the USB cord. You won’t need it to use Snap!

To use the BirdBrain Snap! web app, you must make sure the Chrome settings allow third-party cookies.

Click Find Robots. You will see a list of devices that start with BB (Hummingbird Bit), FN (Finch), or MB (micro:bit). You may see one robot or many, depending on how many are nearby. If you don’t know which robot is yours, write down the first device name on the list, i.e. BB5AE67. Then click that device. Once you know which Hummngbird is connected, use masking tape to label it with the device name you wrote down. This will help you connect to the correct device in the future.

You will hear a sound as the Hummingbird connects, and the initials will stop flashing on the micro:bit. Once you have connected to a Hummingbird, the name of your robot will appear on the screen, and Snap! will load automatically.

If you become disconnected while programming your Hummingbird, click the expand button to see the Find Robots button and reconnect.

You can use Snap! online or offline. To use Snap! offline with the Hummingbird, install it on your Chromebook using the orange install button.

You are ready to begin programming!

Setup with USB (Chromebooks/Mac/Windows)

This module will cover how to connect to the Hummingbird Bit with a USB cord and start programming in Snap!

This option should only be used if your device does not have Bluetooth. If your device has Bluetooth, follow the Bluetooth setup instructions for Chromebooks or Windows/Mac instead.

Insert a micro:bit into your Hummingbird Bit Controller (you might need to push a little harder than you think!), and connect it to the computer with the USB cord. The Hummingbird also needs a source of power, so connect it to the battery pack or AC power adapter.

Open the BlueBird Connector. The BlueBird Connector may need to update the firmware on your micro:bit, so follow any directions that it gives you. After any updates, you will hear a sound as your device connects. The name of your robot should appear under Connected.

You are ready to begin programming! Click the Snap! button to open the Snap! programming environment.

Single Color LED

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.

Please note that there is no sound in these videos.

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 ‘-.’

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 (Snap! defaults to port 1) and the brightness of the LED from 0% to 100%.

When the space bar is pressed, the Hummingbird LED is set to full brightness. Since the LED was never programmed to turn off, the light stays on at full brightness.

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

Put the Hummingbird LED block into a repeat forever loop. Add a wait block, a second Hummingbird LED block, and another wait block to the forever loop. The wait block stops the program for a number of seconds.

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 bottom wait block was not there?

Write a program that makes the LED blink faster. You will have to use decimal points.

Tri-Color LED

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.

Please note that there is no sound in these videos.

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 ‘-.’

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 (Snap! defaults to port 1) and the amount of red, green, and blue from 0% to 100%.

When the space bar is pressed, red is set to full brightness. Since the tri-LED was never programmed to turn off, the red stays on at full brightness.

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

Put the Hummingbird Tri-LED block into a repeat forever loop. Add a wait block, a second Hummingbird Tri-LED block, and a second wait block to the forever loop. The wait block stops the program for a number of seconds.

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?

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

LED Screen

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

Please note that there is no sound in these videos.

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.

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?

Put the micro:bit Display block into a repeat forever loop. Add a wait block, a second micro:bit Display block, and a second wait block to the forever loop. The wait block stops the program for a number of seconds.

Create a face with a different expression in the second micro:bit Display block.

Each time through the forever 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?

Use the micro:bit Display block to create a program that shows your very own animation.

Position Servo

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

Hummingbird Base Kit users have an FS90 Micro Servo that works the same as the servo in these modules.

Please note that there is no sound in these videos.

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

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 (Snap! defaults to port 1) and the angle from 0° to 180°.

When the space bar is pressed, the Hummingbird Position Servo is set to 90°. Since the servo was not programmed to move to any other position, it does not move again.

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?

Put the Hummingbird Position Servo in a repeat forever loop. Add a wait block, a second Hummingbird Position Servo block, and a second wait block to the forever loop. The wait block stops the program for a number of seconds.

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

Reflect: How would the movement of the servo change if the wait blocks were set to .5 seconds instead of 1 second?

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

Rotation Servo

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

The rotation servo is not included in the Hummingbird Bit Base Kit.

Please note that there is no sound in these videos.

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

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 (Snap! defaults to port 1) and the speed from -100% to 100%.

When the space bar is pressed, the Hummingbird Rotation Servo is set to full speed. Since the servo was not programmed to move to stop, it keeps spinning.

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

Put the Hummingbird Rotation Servo in a repeat forever loop. Add a wait block, a second Hummingbird Rotation Servo block, and a second wait block to the forever loop. The wait block stops the program for a number of seconds.

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?

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

Buzzer

This module will show you how to program the buzzer output on the Hummingbird Bit. The buzzer can be used to create different musical tones that come directly from the Hummingbird controller board. The range of the buzzer is 32 to 135. This range uses the same MIDI note numbers as Scratch.

Please note that there is no sound in these videos.

From the Control folder drag out a when space key pressed block. From the Sound folder, drag out a Hummingbird Play Note __ for __ beats block and attach to a when space key pressed block. Change the timing to last for 1 beat. Drag out a second Hummingbird Play Note block and change the note and the beat value. Drag out a third Hummingbird Play Note block and change the note and the beat value.

The range of the buzzer is 32 to 135. These numbers are MIDI note numbers.

The notes you’ve programmed will play for 1 beat, one right after another. In music, the “beat” represents how long a note will play. We’ll learn to speed this up and slow this down next.

Reflect: How could you make the notes play for longer?

To make the notes play faster or slower, use the set tempo to bpm block, located in the Sound folder. Insert the set tempo to bpm block into the top of your script.

The “tempo” is the speed of a song. It is measured in beats per minute (bpm). Snap! defaults to 60 bpm. Change the tempo by clicking the white oval and typing in a new tempo.

Using a bit of math, we can figure out that a song with 120 bpm has beats that last half a second (120 bpm / 60 seconds in a minute = 2 beats in each second). Click the white oval to change the bpm and see how that affects the speed of the notes.

Reflect: What would you set the bpm to make a song where each beat = 1 second?

Next, drag out 2 rest for __ beats block, located in the Sound folder. Place one rest for __ beats block after each Hummingbird Play Note blocks. These blocks will cause there to be a silence, called a “rest.” Click the white oval to adjust the length of each rest.

The notes you’ve programmed will now play with silences or “rests” in between them. You can now program your Hummingbird to play any song at any tempo!

Can you write a program to play a simple song you know?

Light Sensor

This module will show you how to use a light sensor as an input with the Hummingbird Bit. A light sensor is a component that collects data based on how much light surrounds the sensor. The range of the light sensor is 0 to 100.

This module assumes that you have already completed the single color LED module.

Please note that there is no sound in these videos.

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 ‘-.’

Find the Hummingbird Sensor block under the Sensing folder. Use the drop-down menu to select “Light.”

To see the value of the sensor in Snap!, simply click on the Hummingbird Sensor block.

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

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

Plug an LED into LED port 1.

Place a Hummingbird Sensor block inside a Hummingbird LED block.

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

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

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

This program compares the value of the light sensor to 10. If the sensor value is less than 10, the program runs the block inside the if section of the if 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.

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.

Dial Sensor

This module will show you how to use a dial sensor as an input with the Hummingbird Bit. A dial sensor is a component that collects data based on how much you rotate the knob. The range of the dial sensor is 0 to 100.

This module assumes that you have already completed the single color LED module.

Please note that there is no sound in these videos.

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 ‘-.’

Find the Hummingbird Sensor block under the Sensing folder. Use the drop-down menu to select “Dial.”

To see the value of the sensor in Snap!, simply click on the Hummingbird Sensor block.

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

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

Plug an LED into LED port 1.

Place a Hummingbird Sensor block inside a Hummingbird LED block.

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

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

Your dial sensor value can be used to make decisions. To turn on an LED when the value of the sensor is high, use an if else block from the Control folder. This block requires a comparison block, which is in the Operators folder.

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

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.

Distance Sensor

This module will show you how to use a distance sensor as an input with the Hummingbird Bit. A distance sensor is a component that collects data based on how close or far you are to the sensor. The range of the distance sensor is 1 to 260 cm.

The distance sensor is not included in the Hummingbird Bit Base Kit.

This module assumes that you have already completed the single color LED module.

Please note that there is no sound in these videos.

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 ‘-.’

Find the Hummingbird Sensor block under the Sensing folder. Use the drop-down menu to select “Distance.”

To see the value of the sensor in Snap!, simply click on the Hummingbird Sensor block.

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

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

Plug an LED into LED port 1.

Place a Hummingbird Sensor block inside a Hummingbird LED block.

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

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

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

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

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.

Sound Sensor

This module will show you how to use a sound sensor as an input with the Hummingbird Bit. A sound sensor is a component that collects data based on how much sound surrounds the sensor. The range of the sound sensor is 0 to 100.

The sound sensor is not included in the Hummingbird Bit Base Kit.

This module assumes that you have already completed the single color LED module.

Please note that there is no sound in these videos.

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 ‘-.’

Find the Hummingbird Sensor block under the Sensing folder. Use the drop-down menu to select “Sound.”

To see the value of the sensor in Snap!, simply click on the Hummingbird Sensor block.

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

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

Plug an LED into LED port 1.

Place a Hummingbird Sensor block inside a Hummingbird LED block.

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

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

Your sound sensor value can be used to make decisions. To turn on an LED when the value of the sensor is high, use an if else block from the Control folder. This block requires a comparison block, which is in the Operators folder.

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

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.

Buttons

This module will show you how to program the A and B buttons on the micro:bit to control the single color LED output of the Hummingbird Bit. The micro:bit’s A and B buttons can be used as inputs. Pressing them can be an “event” to trigger other actions.

This module assumes that you have already completed the single color LED module.

Please note that there is no sound in these videos.

Plug in a single color LED. The A and B buttons are located on the face of the micro:bit. They can be pressed one at a time or together.

From the Control folder, drag out a when space key pressed, and attach a forever loop. Drag an if statement into the forever loop. From the Sensing folder, nest a micro:bit Button A block in the hexagon space of the if statement. From the Looks folder, drag a Hummingbird LED block into the if statement and set it to 100%.

The A button being pressed causes the Hummingbird LED to turn on.

Reflect: How could you use the A button to turn a tri-color LED red?

Duplicate the if micro:bit Button A loop and insert it into the forever loop below the first one. Use the drop down menu to change Button A to Button B. Program the Hummingbird LED to turn off when the B button is pressed.

The A and B buttons now turn the LED on and off respectively.

Can you use a green and block to make the LED blink 4 times when the A and B buttons are pressed at the same time?

Accelerometer

This module will show you how to use the accelerometer as an input to control the tri-color LED from the Hummingbird. The range of the x, y, and z variables on the accelerometer is -10 to +10 m/s^2.

This module assumes that you have already completed the tri-color LED module.

Please note that there is no sound in these videos.

Plug in the tri-color LED. You do not need to attach the accelerometer. The accelerometer is built into the micro:bit.

From the Control folder, drag out a when space key pressed, forever loop, and if statement block, and connect them with the if statement inside the forever loop.

From the Sensing folder, nest a micro:bit Screen Up block into the hexagon space in the if statement. Use the drop down menu to select “Shake.”

Drag out 2 Hummingbird Tri-LED blocks from the Looks folder and 1 wait block from the Control folder. Write a program to turn the tri-color LED red, wait 1 second, and turn off when the micro:bit is shaken.

When you shake the Hummingbird controller board, your tri-color LED will turn red for 1 second, then turn off.

Reflect: How could you make the tri-color LED blink red and blue 3 times when the micro:bit is shaken, then turn off? (Hint: look in the Control folder for a loop!)

You can also tilt your Hummingbird Bit in different directions to change colors of the tri-color LED.

First, delete the wait and second Hummingbird Tri-LED blocks. Select the drop down menu in the micro:bit Shake block, and change it to read “micro:bit Logo Up.” Duplicate the if statement. Then, click the second drop down menu to select “micro:bit Logo Down.” Change the second Hummingbird Tri-LED to 100% green.

When you tilt the Hummingbird Bit controller forward and back, the tri-color LED will change color from red to green.

Reflect: How could you make this code control a position servo to go from 0 to 180 degrees?

Write a program that makes the tri-color LED turn blue and purple when the Hummingbird Bit is tilted left and right.

While we’ve been using the accelerometer as an event up to this point, you can also use the accelerometer’s value to slowly alter a component by nesting it, which you can also do with sensors.

First, save 1 Hummingbird Tri-LED block, but delete everything else inside the forever loop. Drag a division block from the Operators folder. Nest this block into the white oval next to “R” in the Hummingbird Tri-LED block.

Nest a micro:bit Accelerometer X block from the Sensing folder into the first space in the division block. This accelerometer can measure front to back movement (called x), side to side movement (called y), and up and down movement (called z). Use your keyboard to type the number 10 into the second space of the division block.

Reflect: How could you make the y variable of the accelerometer control the brightness of the blue of the tri-color LED at the same time?

Write a program that:
– Makes the x variable of the accelerometer control the brightness of the red of the tri-color LED.
– Makes the y variable of the accelerometer control the brightness of the blue of the tri-color LED.
– Makes the z variable of the accelerometer control the brightness of the green of the tri-color LED.

Compass

This module will show you how to use the compass as an input to control the movement of a Hummingbird position servo. The range of the compass is 0° to 359°.

This module assumes that you have already completed the position servo module.

Please note that there is no sound in these videos.

First, we must calibrate the compass. To do this, click the purple compass icon next to your Hummingbird’s name in the Bluebird Connector App. When prompted, tilt your Hummingbird every direction in the air. If successfully calibrated, a check mark will appear on both the LED screen and next to your Hummingbird’s name. If unsuccessful, try again.

Check your Hummingbird’s calibration by dragging out a micro:bit Compass block from the Sensing folder. Click the block to read the sensor value. Redirect your Hummingbird and click the block again. Repeat this process to see the different headings, from 0-360º.

Reflect: What number represents South?

Plug in the position servo. You do not need to attach the compass. The compass is built into the micro:bit.

From the Control folder, drag out a when space key pressed block and a forever loop. From the Motion folder, drag a Hummingbird Position Servo block into the forever loop. Nest the micro:bit Compass block into the Hummingbird Position Servo block.

The position servo will now rotate to match the compass heading. Although the range of the compass is 0°-359°, the position servo will stop at 180 degrees, because the range of the position servo is 0°-180°.

Reflect: How could you use the compass to control the brightness of a single color LED?

The compass value can also be used to make decisions. We will now set your position servo to either 0 or 180 degrees based on the compass value.

First, drag the micro:bit Compass and Hummingbird Position Servo blocks apart and outside of the forever loop. Drag an if else block from the Control folder into the forever loop. Nest a less than block from the Operators folder into the hexagon space of the if else block. Nest the micro:bit Compass block into the first space in the less than block. Set the threshold to 180 degrees.

Drag the Hummingbird Position Servo block into the first open space of the if else block and set it to “0.” Drag another Hummingbird Position Servo block into the second open space of the if else block and set it to “180.”

This program compares the value of the compass to 180. If the compass value is less than 180 (indicating west), the position servo is set to 0 degrees. When the compass value is greater than 180 (indicating east), the position servo is set to 180 degrees.

Reflect: How could you use a similar code to turn a tri-color LED red and blue based on the value of the compass?

What kind of robot could you build that would respond to data from the compass?

Multiple Devices

This module will show you how to connect multiple devices through the Bluebird Connector App. It will also show you how to wirelessly control the outputs of one Hummingbird with the inputs of another. For this module, you will need 2 Hummingbird Bit boards*, 1 tri-color LED, and 1 dial sensor.

This module assumes that you have already completed the tri-color LED, buttons, and sensor modules.

*In steps 2-7, you will be using a micro:bit by itself without a Hummingbird controller board. To power this micro:bit, you can either use a AAA battery pack or the USB cord included in your kit.

Please note that there is no sound in these videos.

Plug in the tri-color LED into port 1. You will also need a separate micro:bit unplugged from a Hummingbird, which you can power by a USB cable or AAA battery pack (not included). We will be using a battery pack.

We will begin by connecting 2 devices. We will first be connecting a Hummingbird Bit and also a micro:bit by itself.

This step will follow how to connect two devices in the BlueBird Connector. The following step will cover how to connect two devices using the BirdBrain Snap! web app.

If you are using the BlueBird Connector, select the Find Robots button. Select the two devices you’re using by clicking the + icon. Connect the micro:bit first. Then connect the Hummingbird. The process of connecting them can take a couple seconds. Open Snap!

If you are using the BirdBrain Snap! web app, first connect the micro:bit. The name of the micro:bit will start with the letters MB. You will not hear a sound as the micro:bit connects, but it will stop flashing letters on the display.

Then click the expand button. Click Find Robots and select the Hummingbird. The name of the Hummingbird will start with the letters BB.

Both devices should show up as connected. The micro:bit will be labeled with an ‘A’ and the Hummingbird with a ‘B.’ A Snap! project that can use multiple devices will automatically be loaded.

We will now program the sending and receiving components of the robots. We will write a program that changes the color of a tri-color LED using the micro:bit’s A and B buttons.

From the Control folder, drag out a when space key pressed block, a forever loop, and if statement block, and connect them with the if statement inside the forever loop. From the Sensing folder, nest a micro:bit A Button A block into the hexagon space of the if statement.

From the Looks folder, drag out a Hummingbird Tri-LED block into the open space of the if statement. Select “B” from the first Hummingbird Tri-LED the drop down menu. Set R to 100%.

When the A button is pressed on the mircro:bit, the tri-color LED on the Hummingbird turns red.

Reflect: Could you write a similar script to make a message or picture appear on the LED screen of the Hummingbird when you press the A button on the micro:bit?

Now we want to program our robots so that pressing the A and B buttons on the micro:bit will turn the Hummingbird tri-color LED red and blue.

First, duplicate the if statement containing micro:bit A Button A and place it below the first if statement within the forever loop. Change it to micro:bit A Button B, and change the second Hummingbird Tri-LED to 100% blue.

When the A button is pressed on the micro:bit, the Hummingbird tri-color LED turns red. When the B button is pressed on the micro:bit, the Hummingbird tri-color LED turns blue.

Reflect: Could you do something similar with a position servo, setting it to either 0 or 180 degrees based on which button is pressed?

Disconnect the micro:bit from the Bluebird Connector App by clicking the red minus sign next to your micro:bit. The micro:bit will resume flashing 3 letters. Plug this micro:bit into a Hummingbird controller board. Then plug a dial sensor into Sensor port 1. Reconnect the second Hummingbird to the Bluebird Connector App.

We will call the first the Hummingbird you were using HB1. The Hummingbird you just connected will be HB2.

Now we’re going to program a dial sensor on HB2 to control the tri-color LED on HB1.

First, delete everything but the when space key pressed and forever blocks. From the Control folder, drag an if else statement into the forever loop. From the Operators folder, nest a less than block into the hexagon shape of the if else statement. From the Sensing folder, nest a Hummingbird Light sensor block into the first open space in the less than block. Use the second drop down menu to select “Dial.” Set the threshold to 50.

From the Looks folder, drag a Hummingbird Tri-LED block into the first open space and set it to 100% red. Drag another Hummingbird Tri-LED block into the “else” space and set it to 100% blue. Set both Hummingbird Tri-LED blocks set to “Hummingbird B.”

When you turn the dial above 50% on HB1, the tri-color LED on HB2 turns blue. When you turn the dial below 50% on HB 1, the tri-color LED on HB2 turns red.

Reflect: Could you recreate this same function with a different sensor?

Now we will use the dial on HB1 to control the brightness of the tri-color LED on HB2 in real time.

Save the Hummingbird A Dial block and the Hummingbird B Tri-LED block. Delete everything else inside the forever loop. Drag the Hummingbird B Tri-LED block into the forever loop. Nest the Hummingbird A Dial block into the “R” space on the Hummingbird B Tri-LED block.

As you turn the dial sensor on HB1, the brightness of the tri-color LED on HB2 will increase and decrease in real time.

Reflect: How could you make the dial also control the brightness of the blue light in the tri-color LED?

Combining skills and components like accelerometer, compass, and motors can make for some great animatronic and puppeteering projects. What sort of animatronic puppet could you make, controlled by multiple devices?

Variables

What is a variable? In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Using variables with the Hummingbird Robotics Kit will help you create robots with more advanced functions.

Before you begin this module, make sure that you have completed the single color LED module, the position servo module, the buttons module, and at least one of the sensor modules.

You can name a variable anything you want, but it makes most sense to give it a name that matches its function. In this module, we are creating a variable that counts up and down when the A and B buttons are pressed, so a good name for this variable is “count.”

In order to make a variable count backwards, you need to change that variable by a negative number.

To associate an LED with a variable, drag the rounded variable block into the intensity space on the LED block. Make sure the LED block is in a forever loop.

Nesting a variable into an output block is one way to use a variable. You can also use a variable to control robot expressions. If the variable equals 1, your robot can perform one set of actions. If you variable equals 2, your robot can perform a different set of actions.

Try building a robot using the variable to control different expressions. You can build any type of robot you want, but we recommend building the Tiny Drummer.

Creating a variable that counts on its own will require a good understanding of how loops work and of how wait blocks work. Create a variable that counts upwards on its own, then associate that counting variable with an LED. How does the LED react?

Getting a variable to stop counting on a specific number will require the use of a repeat until block and an = operator block

Programming a position servo to move slowly is very similar to programming an LED to fade in and out. Nest the counting variable block inside of a position servo block instead of an LED block. 

To manually control the speed of that position servo with the A and B buttons we will need a new variable. Create a second variable and call it “time.”

Nest the time variable block in the wait blocks. Use the A and B buttons to incrementally change the “time” variable. By controlling the wait times between servo positions, you are controlling the speed of your servo.

If the wait time between servo positions is too big or too small, the servo can become difficult to work with. Set some parameters for your time variable. There are many ways to set variable parameters. 

Try to build a robot that uses 2 slow moving servos. You can build anything you want, but we recommend the Little Bot.