Print Skip To Hex File

Hummingbird Bit: BirdBlox Lessons

Rover: Tablet Control

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

Setup

((vim videoid=h0hf04bfyx wl=0))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_1-768x432.jpg))

This module will cover how to connect to the Hummingbird Bit and start programming in BirdBlox.

Please note that there is no sound in these videos.

Install BirdBlox onto your tablet or smartphone.

((vim videoid=lkazqa0ryu wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_3-768x432.jpg))

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. If you are using rechargeable batteries, check out this support article before using.

((vim videoid=gioynomuzp wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_4-768x432.jpg))

Optional step: If your micro:bit is already flashing 3 or 10 letters when powered on, you can skip this step.

Download this file and drag it onto the micro:bit (you will need a computer with a USB port for this step). Your device should start to flash ten letters on its display. You will only need to complete this step once for each Hummingbird – as long as your device is flashing its initials, you are ready to connect via Bluetooth.

Download Hex File

((vim videoid=k79sh4bdaw wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_5-768x432.png))

Remove the USB cord. You are ready to program wirelessly with BirdBlox!

((vim videoid=t673unp75s wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_6-1-768x432.jpg))

Open BirdBlox.

Tap New to create a new program.

Give your program a descriptive name.

((vim videoid=venbr7iqc4 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Setup_7-768x432.jpg))

Tap the Hummingbird Connect button. Select Connect Device.

Tap the name of your device. To identify your device, look at the three letters that flash on the micro:bit before the # symbol. Match these to the Bit name(s) on tablet.

When you connect to the Bit, you will hear the connection tone, and the initials will stop flashing. On the tablet screen, the dot on the Hummingbird Connect button will turn green, and the blocks for the Bit will turn teal.

Note: If you lose the connection to the Hummingbird, the initials will start to flash, the dot on the Hummingbird Connect button will turn red, and the blocks for the Bit will turn gray. If this happens, tap the Hummingbird Connect button, select Disconnect Device, and then reconnect.

In addition to the programming tutorials on this page, we have a lot of other resources to help you work with with your Hummingbird Kit.

  • Our coding cards provide printable programming help for your students.
  • Our blocks document is a handy reference guide that lists all the Hummingbird blocks in BirdBlox.
  • Our Build pages offer tutorials and inspiration for building your own robots and mechanisms.
  • Our free Professional Development course ties everything together in an online course you can watch at your own pace.

Sharing Files

Introduction

This module will show you how to email a program to and from BirdBlox and provide links to articles that describe cloud-based methods of sharing files.

If you are still learning to program your Hummingbird, skip to the Single Color LED module and come back here when you want to share your program.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/pasted-image-0-55-768x437.png))

Emailing a File

To email a file to yourself or someone else, tap the File button in BirdBlox.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/pasted-image-0-52.png))

Then tap the Share button by the name of the file you wish to share.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/pasted-image-0-53-768x431.png))

Then select the mail icon.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/pasted-image-0-54-768x432.png))

Add the email address and subject. Tap Send.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/pasted-image-0-55-768x437.png))

Opening a File from Email

To open a file from your email inbox, tap the file. In the menu that pops up, select BirdBlox (Android and Kindle) or Copy to BirdBlox (iOS). In iOS, you may need to scroll to the right to see this option. The file will open in BirdBlox!

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/unnamed-6.png))

There are a number of other sharing options available in BirdBlox! Use these links to learn more.

Single Color LED

((vim videoid=t34cbc089l wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_HumbitLED_1-768x432.jpg))

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.

((vim videoid=i4grfkkyh0 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_LED_2-768x432.jpg))

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

((vim videoid=fjyw30dg0d wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_LED_3-768x432.jpg))

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

((vim videoid=55w3bi7vaw wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_LED_4-768x432.jpg))

When the green flag is tapped, the Bit 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%?

 

((vim videoid=x9jlxssh1r wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_LED_5-768x432.jpg))

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

((vim videoid=grgx5juzq3 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_LED_6-768x432.jpg))

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?

((vim videoid=zkfazqep45 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_LED_7-768x432.jpg))

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

Tri-Color LED

((vim videoid=ytiru3i24i wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_1-768x432.jpg))

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.

((vim videoid=98hjyvcr89 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_2-768x432.jpg))

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

((vim videoid=l43m2zxpk5 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_3-1-768x432.jpg))

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

((vim videoid=18zhvbcuxh wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_4-768x432.jpg))

When the green flag is tapped, 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?

((vim videoid=m3pc97n3gf wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_5-1-768x432.jpg))

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

((vim videoid=4lm1xbyhxz wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_TriLED_6-768x432.jpg))

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?

((vim videoid=gpimqy9cc3 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_Snap_TriLED_7-768x432.jpg))

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

LED Screen

((vim videoid=zzgghk0sg3 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_LEDScreen_1-768x432.jpg))

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

Please note that there is no sound in these videos.

((vim videoid=5axbmu9ltm wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Screen_2-768x432.jpg))

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

((vim videoid=v5kn4015n8 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/StillBirdBlox_Humbit_LEDScreen_3-768x432.jpg))

When the green flag is tapped, the 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?

((vim videoid=rtkdsapxsg wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Screen_4-768x432.jpg))

Put the Bit Display block into a repeat forever loop. Add a wait block, a second 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 Bit Display block.

((vim videoid=fq68cn6dhy wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_LEDScreen_5-768x432.jpg))

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?

((vim videoid=j8lvck2w8r wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_Snap_Screen_6-768x432.jpg))

Use the Bit Display block to create a program that shows your very own animation.

Position Servo

((vim videoid=3rkykhmmeg wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_PServo_1-768x432.jpg))

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.

((vim videoid=0ckiknl45h wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_PServo_2-768x432.jpg))

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

((vim videoid=e89afzrfqb wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_PServo_3-768x432.jpg))

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

((vim videoid=nvcd3uhs4v wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/StillBirdBlox_Humbit_Pservo_4-1-768x432.jpg))

When the green flag is tapped, the Bit 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?

((vim videoid=yo8vg8v55h wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_PServo_5-768x432.jpg))

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

((vim videoid=fpil9dmsua wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/StillBirdBloc_Humbit_PServo_6-768x432.jpg))

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 wait blocks were set to .5 seconds instead of 1 second?

((vim videoid=nvcaowt3at wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_Snap_PServo_7-768x432.jpg))

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

Rotation Servo

((vim videoid=q86h1fvb5v wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_humbit_RServo_1-768x432.jpg))

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.

((vim videoid=i8gbv8v10n wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_RServo_2-768x432.jpg))

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

((vim videoid=7t2j5a15gm wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_RServo_3-768x432.jpg))

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

((vim videoid=haohcw92ba wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/StillBirdBlox_humbit_RServo_4-768x432.jpg))

When the green flag is tapped, the Bit Rotation Servo is set to full speed. Since the servo was not programmed to stop, it keeps spinning.

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

((vim videoid=k50wu880ba wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_RServo_5-768x432.jpg))

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

((vim videoid=9hwzp5krak wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_BirdBlox_Humbit_RServo_6-768x432.jpg))

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 Bit Rotation Servo block to 40 instead of 0?

((vim videoid=c6ts5exf3s wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_Snap_RServo_7-768x432.jpg))

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

Buzzer

((vim videoid=flr485hkx9 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_1-768x432.jpg))

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 and Snap!.

Please note that there is no sound in these videos.

((vim videoid=stj0dk95ce wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_2-768x432.jpg))

Drag out the Bit Play Note __ for __ Beats block from the Robots folder and attach to a when Green Flag tapped block. Drag out a second Bit Play Note block and change the note. Drag out a third Bit Play Note block and change the note.

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

((vim videoid=aypidvtm77 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_3-768x432.jpg))

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?

((vim videoid=zk22s3e1tf wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_4-768x432.jpg))

To make the notes play faster or slower, use the set tempo to __ bpm block, located in the Sound folder. Snap 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). BirdBlox defaults to 60 bpm. Change the tempo by clicking the white oval and typing in a new tempo.

((vim videoid=5iiki2wd1w wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_5-768x432.jpg))

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?

((vim videoid=jfk7carxcs wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_6-768x432.jpg))

Next, drag out 2 rest for __ beats block, located in the Sound folder. Place one rest for __ beats block after each Bit 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.

((vim videoid=3ewmhj6lte wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_7-768x432.jpg))

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!

((vim videoid=uf9femiahd wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Buzzer_8-768x432.jpg))

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

Sound

Introduction

In this module, you will learn how to record and play sounds with BirdBlox. This will enable you to use BirdBlox to play recorded sounds, such as your favorite song or a voice reading a story or poem. These sounds will play through the tablet, rather than through the Hummingbird.

Playing Sounds

The Sound menu in BirdBlox contains blocks that can be used to play sounds through the tablet speakers.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/newsound.jpeg))

The play sound and play sound until done blocks can be used to play one of a number of precorded sounds. You can select a sound from the drop-down menu. The play sound block will start the sound and then move immediately to the next line in the program. For example, when you run this program, the light comes on as soon as you start the sound.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/newsound2.png))

The play sound until done block will pause the program until the sound is complete. That means that when you run this program, the light will not come on until the sound has finished.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/newsound3.png))

CHALLENGE

Use a servo and the sound blocks to make an alarm. Set the servo to one position and make a ticking sound. After the ticking, move the servo to a different position and sound the alarm!

Click Here to see example code.

Recording Sounds

You can also record your own sounds in BirdBlox. Tap Record Sound on the Sound menu. Then press the Record button and give BirdBlox permission to use the microphone.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/bbsound2-768x824.png))

You can record up to five minutes of sound. Tap the Stop button when you are done.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/bbsound3-768x822.png))

Your recording will appear. You can play it back or rename it from this screen. Then tap Done.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/bbsound4-768x818.png))

CHALLENGE

Record a portion of a favorite song in BirdBlox.

Playing Recordings

Once you have recorded a sound, you can play it using the play recording or play recording until done blocks from the Sound menu.

The play recording block will start the sound and then move immediately to the next line in the program, while the play recording until done block will pause the program until the sound is complete.

For example, this program will play the recording while the servo moves back and forth.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/newsound4.png))

If you need to, you can use the stop all sounds block to stop a sound or a recording in the middle.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/sound7.png))

CHALLENGE

Create a light show with music and your Hummingbird LEDs.

Click Here to see example code.

Light Sensor

((vim videoid=cijsxk94r5 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/Screenshot-2019-08-13-14.39.42-768x409.png))

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.

((vim videoid=mz15lmgl47 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_BirdBlox_Humbit_Sensors_2-1-768x432.jpg))

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

((vim videoid=0dk3kugxwq wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/BirdBlox_Sensor_3-1-768x432.jpg))

Find the Bit Sensor block near the bottom of the Robots folder. Use the drop-down menu to select “Light.”

To see the value of the sensor in BirdBlox, simply click on the Bit Sensor block.

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

((vim videoid=3wsd7fy46e wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_Snap_Distance_4-768x432.jpg))

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

Plug an LED into LED port 1.

((vim videoid=kffyh83xxz wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_LIGHT_5-1-768x432.jpg))

Place a Bit Sensor block inside a Bit LED block.

((vim videoid=c2ncrvrl0e wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Sensor_6-1-768x432.jpg))

The Bit 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 Bit LED block about 25 times per second. What do you think would happen if you added a wait block to the repeat forever loop?

((vim videoid=2ve789q71h wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_LIGHT_7-1-768x432.jpg))

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.

((vim videoid=i94c371gum wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILLBirdBlox_Humbit_Sensor_8-1-768x432.jpg))

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.

((vim videoid=qln8j4yu0z wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sensors_9-768x432.jpg))

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

((vim videoid=kgx73bpqcb wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_1-768x432.jpg))

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.

((vim videoid=zc80hvcmo1 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_2-768x432.jpg))

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

((vim videoid=0fiybkfgos wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_3-768x432.jpg))

Find the Bit Sensor block near the bottom of the Robots folder. Use the drop-down menu to select “Dial.”

To see the value of the sensor in BirdBlox, simply click on the Bit Sensor block.

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

((vim videoid=jje3krhqj2 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_4-768x432.jpg))

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

Plug an LED into LED port 1.

((vim videoid=32u4ky6dk8 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_5-768x432.jpg))

Place a Bit Sensor block inside a Bit LED block.

((vim videoid=0i57jui7bs wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_6-768x432.jpg))

The Bit 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 Bit LED block about 25 times per second. What do you think would happen if you added a wait block to the repeat forever loop?

((vim videoid=2xmladot7o wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_7-768x432.jpg))

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.

((vim videoid=bpawnui26d wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_8-768x432.jpg))

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.

((vim videoid=mds4va8n18 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Dial_9-768x576.jpg))

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

((vim videoid=q86zodv78l wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_1-768x432.jpg))

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.

((vim videoid=1jau37ikwh wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_2-768x432.jpg))

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

((vim videoid=eyjnrsfhpu wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_3-768x432.jpg))

Find the Bit Sensor block near the bottom of the Robots. Use the drop-down menu to select “Distance.”

To see the value of the sensor in BirdBlox, simply click on the Bit Sensor block.

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

((vim videoid=zxnsqk6dks wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_4-768x432.jpg))

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

Plug an LED into LED port 1.

((vim videoid=46in0ys9vk wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_5-768x432.jpg))

Place a Bit Sensor block inside a Bit LED block.

((vim videoid=a299flovvw wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_6-768x432.jpg))

The Bit 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 Bit LED block about 25 times per second. What do you think would happen if you added a wait block to the repeat forever loop?

((vim videoid=cu46m41oxc wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_7-768x432.jpg))

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.

((vim videoid=hjg7bho9q9 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_8-768x432.jpg))

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.

((vim videoid=vdcz7a9p0h wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Distance_9-768x576.jpg))

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

((vim videoid=9ruxcygov1 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_1-768x432.jpg))

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.

((vim videoid=6uptjhg0x5 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_2-768x432.jpg))

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

((vim videoid=4t8xju8qyt wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_3-768x432.jpg))

Find the Bit Sensor block near the bottom of the Robots folder. Use the drop-down menu to select “Sound.”

To see the value of the sensor in BirdBlox, simply click on the Bit Sensor block.

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

((vim videoid=oqqkh24nqx wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_4-768x432.jpg))

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

Plug an LED into LED port 1.

((vim videoid=wayse6o8iw wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_5-768x432.jpg))

Place a Bit Sensor block inside a Bit LED block.

((vim videoid=9qcfmni14f wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_6-768x432.jpg))

The Bit 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 Bit LED block about 25 times per second. What do you think would happen if you added a wait block to the repeat forever loop?

((vim videoid=ttsmm7oxcy wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_7-768x432.jpg))

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.

((vim videoid=vdujn10pts wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_8-768x432.jpg))

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.

((vim videoid=xh9zraoyet wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Sound_9-768x576.jpg))

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

((vim videoid=f0tbcmy2kp wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_1-768x432.jpg))

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.

((vim videoid=9n2zgl1qnt wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_2-768x432.jpg))

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.

((vim videoid=f3eyww9rmd wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_3-768x432.jpg))

From the Control folder, drag out a when green flag tapped block, and attach a repeat forever loop. Drag an if statement into the forever loop. From the Robots folder, drag out a Bit button A block and place it in the hexagon of the if statement. Drag a Bit LED block into the if statement and set it to 100%.

((vim videoid=s7ru7kiymd wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_4-768x432.jpg))

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?

((vim videoid=smt5qg514d wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_5-768x432.jpg))

Duplicate the if 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 Bit LED to turn off when the B button is pressed.

((vim videoid=i6ifrmcwzi wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_6-768x432.jpg))

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

((vim videoid=hv6uxa379k wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Button_7-768x432.jpg))

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

Accelerometer

((vim videoid=nroyaf5vqp wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_1-768x432.jpg))

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.

((vim videoid=egyr4mem5k wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_2-768x432.jpg))

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

((vim videoid=cwptnucy20 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_3-768x432.jpg))

From the Control folder, drag out a when green flag tapped block, repeat forever loop, and if statement block, and connect them with the if statement inside the repeat forever loop.

Nest a Bit Screen Up block from the Robots folder into the hexagon space of the if statement. Use the drop down menu to select “Shake.”

Drag out 2 Bit Tri-LED blocks from the Robots 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.

((vim videoid=jb0fgmsgcy wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_4-768x432.jpg))

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!)

((vim videoid=6unbzzov6h wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_5-1-768x432.jpg))

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

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

((vim videoid=xr21eloje9 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_6-768x432.jpg))

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?

((vim videoid=loffj7hcu5 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_7-768x432.jpg))

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

((vim videoid=mwl6ghmmyk wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_8-768x432.jpg))

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 Bit Tri-LED block, but delete everything else inside the repeat forever loop. Nest a Bit Accelerometer block inside the Bit Tri-LED “R” oval. The range of the accelerometer is -10 to +10 m/s^2.

((vim videoid=1us7m7vztm wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_9-768x432.jpg))

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?

((vim videoid=7lpibtj7wx wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Accelerometer_10-768x432.jpg))

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

((vim videoid=6t9g22g9y1 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_1-768x432.jpg))

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.

((vim videoid=9nwyy19pix wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_2-768x576.jpg))

First, we must calibrate the compass. To do this, click the settings icon in the top left corner and click “Calibrate Compass.” Select your Hummingbird. 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.

((vim videoid=rsh4njilp6 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_3-768x576.jpg))

Check your Hummingbird’s calibration by dragging out a Bit Compass block from the Robots 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?

((vim videoid=q1xc26yvew wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_4-768x432.jpg))

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

((vim videoid=8a7rx2kllp wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_5-768x432.jpg))

From the Control folder, drag out a when green flag tapped and a repeat forever loop. From the Robots folder, drag a Bit Position Servo block into the repeat forever loop. From the Robots folder, nest the Bit Compass block into the Bit Position Servo block.

((vim videoid=xn19s9fvfp wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_6-768x432.jpg))

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?

((vim videoid=z4qauki0o9 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_7-768x432.jpg))

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 Bit Compass and Bit Position Servo blocks apart and outside of the repeat forever loop. Drag an if else block from the Control folder into the repeat forever loop. Nest a less than block from the Operators folder into the hexagon space of the if else block. Nest the Bit Compass block into the first space of the less than block. Set the threshold to 180 degrees.

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

((vim videoid=jb0eg6wxsc wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_8-768x432.jpg))

This program compares the value of the compass to 180. If the compass value is less than 180 (indicating west), the program runs the block inside 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?

((vim videoid=awd2bfmfhx wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_Compass_9-768x432.jpg))

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

Multiple Devices

((vim videoid=s41rpnx8lc wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_1-768x432.jpg))

This module will show you how to connect multiple devices through the BirdBlox App. It will also show you how to control the outputs of one Hummingbird with the inputs of another, wirelessly. 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.

((vim videoid=mw6zuouxdz wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_2-768x432.jpg))

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.

((vim videoid=jioifi8rwf wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_3-768x576.jpg))

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

First, select the Hummingbird Connect button in the top left of the BirdBlox screen. Select “Connect Multiple.” Select the + icon to connect devices. Connect the Hummingbird first. Then connect the micro:bit. Select “Done.”

((vim videoid=6ob91vd5zy wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_4-768x432.jpg))

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 green flag tapped block, repeat forever loop, and if statement block, and connect them with the if statement inside the repeat forever loop.

Go to the Robots folder, and minimize the Hummingbird Bit blocks by touching the small arrow. Maximize the micro:bit blocks by touching the small arrow. Nest a micro:bit Button A block into the hexagon space of the if statement block.

Minimize the micro:bit blocks and maximize the Hummingbird Bit blocks. Drag our a Bit Tri-LED block into the open space of the if statement. Change the Bit Tri-LED to 100% red.

((vim videoid=gdffbovk1x wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_5-768x432.jpg))

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?

((vim videoid=f43sgwb5q9 wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_6-768x432.jpg))

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 button A and place it below the first if statement within the repeat forever loop. Change it to micro:bit button B, and change second Bit Tri-LED to 100% blue.

((vim videoid=62ivb0cv8x wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_7-768x432.jpg))

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?

((vim videoid=fg0d1gi2bc wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_8-768x432.jpg))

Disconnect the micro:bit from the BirdBlox App by clicking the Hummingbird Connect button in the top left and pressing the X 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. Connect the second Hummingbird using the Hummingbird Connect button.

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

((vim videoid=gjblg025ko wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_9-768x432.jpg))

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 green flag tapped and repeat forever blocks. From the Control folder, drag an if else statement into the repeat forever loop. From the Operators folder, nest a less than block into the hexagon shape of the if else statement. From the Robots folder, nest a Bit Light sensor block into the first open space in the less than block. Use the first drop down menu to select “Bit 2” (meaning HB2), and use the second drop down menu to select “Dial.” Set the threshold to 50.

Drag a Bit Tri-LED block into the first open space and set it to 100% red. Drag another Bit Tri-LED block into the “else” space and set it to 100% blue. Leave both Bit Tri-LED blocks set to Bit 1.

((vim videoid=33iozwsabc wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_10-768x432.jpg))

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

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

((vim videoid=utxpoiwxjy wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_11-768x432.jpg))

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

Save the Bit 2 Dial block and the Bit 1 Tri-LED block. Delete everything else inside the forever loop. Drag the Bit 1 Tri-LED block into the forever loop. Nest the Bit 2 Dial block into the “R” space on the Bit 1 Tri-LED block.

((vim videoid=9zq6memjzn wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_12-768x432.jpg))

As you turn the dial sensor on HB2, the brightness of the tri-color LED on HB1 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?

((vim videoid=rtry6qmi1n wl=1))
((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2018/12/STILL_Humbit_BirdBlox_MultiDevice_13-768x432.jpg))

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?

micro:bit V2 Sensors

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/bitv2sensors2-768x450.png))

If your Hummingbird contains a micro:bit V2, you have three additional sensors: a touch sensor, a sound sensor, and a temperature sensor. This module will show you how to use these sensors.

The Touch Sensor

The gold micro:bit logo is a button that returns true if you are touching it and false if you are not. This sensor is a third drop-down option in the Bit Button block.

For example, you can make a tri-LED turn green when you are touching the button and red otherwise.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image3-6.png))

CHALLENGE

Write a program that moves the position servo to 0° when you press button A, 90° when you press button B, and 180° when you touch the logo.

Click Here to see example code.

The Sound Sensor

The micro:bit sound sensor can detect a noise like a clap. This is similar to the sound sensor that comes with the Hummingbird Premium kit, but it is contained in the micro:bit rather than a separate sensor. The range of the sound sensor is 0-100. 

The sound sensor is the default option in the Bit Sound/Temperature block. For example, you can make the rotation servo stop when the Hummingbird detects a noise.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image4-5.png))

The Bit Sound/Temperature block will be gray if you do not have a micro:bit V2. This means you cannot use it.

CHALLENGE

Make the Hummingbird play a note when you clap your hands.

Click Here to see example code.

The Temperature Sensor

The micro:bit temperature sensor returns the temperature in degrees Celsius. This sensor is a drop-down option in the Bit Sound/Temperature block. For example, you can display an “H” on the micro:bit when the temperature is warmer than 20 degrees, and a “C” otherwise.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image5-6.png))

CHALLENGE

Make a tri-color LED turn blue when the Hummingbird detects that it is cold and red otherwise.

Click Here to see example code.

Variables

((vim videoid=scuqb5gljw wl=1))
((img class=img-responsive src=))

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.

((vim videoid=g4teboipvc wl=1))
((img class=img-responsive src=))

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

((vim videoid=8virpfew0m wl=1))
((img class=img-responsive src=))

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

((vim videoid=lt51pizjho wl=1))
((img class=img-responsive src=))

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.

((vim videoid=ea072n62id wl=1))
((img class=img-responsive src=))

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.

((vim videoid=elw8o4vpf6 wl=1))
((img class=img-responsive src=))

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?

((vim videoid=ojcma0apcs wl=1))
((img class=img-responsive src=))

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

((vim videoid=yrg6hmj44s wl=1))
((img class=img-responsive src=))

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

((vim videoid=dycbs3ksqv wl=1))
((img class=img-responsive src=))

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.

((vim videoid=4jvxq6336d wl=1))
((img class=img-responsive src=))

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.

Rover: Driving and Avoiding Obstacles

((vim videoid=2twdzx6twj wl=1))
((img class=img-responsive src=))

In this module, you will program a mobile robot to move and avoid obstacles. You will need a rover for this module, so go ahead and build one with this tutorial. We kept our rover pretty simple, but feel free to make yours a parade float, a bananamobile, or whatever you can dream up!

Note: The rover modules assume that you have already completed the modules in the Inputs and Outputs sections.

Moving Forward and Back

The two rotation servos on the rover point in opposite directions. 

This means that to move the rover forward, the two servos must move in opposite directions.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image4.png))

To move the rover forward, set the speed of rotation servo 1 to 100% and the speed of rotation servo 2 to -100%.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image17-768x699.png))

CHALLENGE

Try out this code. Experiment with different wheel speeds to see how you can move the rover in different ways. How can you move backward?

Click Here to see example code.

Turning

When the speeds of the rotation servos are equal, the robot turns in place. 

Notice that this code turns the rotation servos off at the end of the program. Otherwise, they will remain on when the script ends, and the rover will keep spinning.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image22.png))

CHALLENGE

Try out this code. How can you change how far the robot turns?

Click Here to see example code.

Avoiding Obstacles

You can use the distance sensor to help your robot avoid obstacles. This program will stop the rover when it sees an obstacle less than 20 cm away. Otherwise, the rover will move forward.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image1.png))

CHALLENGE

Modify your program to make the rover back up and turn left when it sees an obstacle. Now your rover can wander around the room!

Click Here to see example code.

Adding Extras

The rover also has two tri-color LEDs for headlights and a servo that controls the steering wheel. You can incorporate these components into your program as well.

CHALLENGE

Make the headlights turn red when the rover is moving away from an obstacle and green when the rover is moving forward. Make your driver steer by turning the steering wheel to the left as the robot turns left and back to the center when it is moving forward or back.

Click Here to see example code.

Rover: Randomness

((vim videoid=65cranijl9 wl=1))
((img class=img-responsive src=))

In this module, you will learn to generate random numbers and use them to create interesting and sometimes unexpected behaviors for your rover. For example, you can use random numbers to make the rover move randomly with random colors for the headlights.

Generating Random Numbers

The pick random block is on the Operators menu in BirdBlox. This block randomly chooses a number between the two limits given. For example, this block generates a number between 1 and 100. Each time you tap the block, it will give you a different number.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image3.png))

You can use the pick random block anywhere that you would use a number in your program. For example, this program sets the speed of each rover wheel to a random number every two seconds. This program will make your rover wander randomly about the room!

Notice that each wheel gets a different random number, so the Finch will mostly turn but sometimes move straight. The random number for rotation servo 2 is multiplied by -1 to make this number negative.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image13-768x381.png))

CHALLENGE

Use the pick random block to set the rover headlights to different random colors as the Finch moves randomly around the room.

Click Here to see example code.

Randomness with Variables

If you want to set both headlights to the same random color, you can add a variable to your program. Create a variable called red. If you need more information about how to make and use a variable, refer to the Variables module.

Set your variable equal to a random number between 0 and 100. Then set the amount of red for the tri-color LEDs to red.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image21.png))

CHALLENGE

Create two variables, green and blue. Set each of these variables to a random number, and then use these variables to set the amount of green and blue light for both tri-color LEDs. When you are done, your program should set both tri-color LEDs to the same random color every second.

Click Here to see example code.

Rover: Tablet Control

((vim videoid=1hydchv8xu wl=1))
((img class=img-responsive src=))

BirdBlox contains blocks that tell you the orientation of the tablet. This module will show you how to use these blocks to write a program to control the rover by tilting the tablet.

The Tablet Orientation Block

The Tablet Orientation block on the Tablet menu is a Boolean block that tells you whether or not the tablet is in a particular position. For example, this code will move the rover forward when the tablet is positioned so that the camera is down. When the tablet is positioned with the screen up (flat on the tablet) the rover will stop.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image9-768x253.png))

CHALLENGE

Write scripts to make the rover move and turn based on the orientation of the tablet. The robot should move both forward and back and turn in both directions. The robot should stop when the tablet is positioned with the screen up.

Click Here to see example code.

The Tablet Accelerometer Block

To get finer control of the rover’s speed, you can use the Tablet Accelerometer block to directly control the rotation servos. 

The tablet accelerometer measures any force that causes acceleration in the x-, y-, or z-direction. Because the tablet is usually moving pretty slowly, the accelerometer mostly measures the acceleration due to gravity. When the tablet is sitting on a level surface, the acceleration due to gravity points through the base of the tablet, along the negative z-axis. If you instead position the tablet so that its camera is at the bottom, the acceleration due to gravity points along the positive y -axis. The Tablet Accelerometer block enables you to measure these differences.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image19.png))

To use the Tablet Accelerometer block, select the axis (X, Y, or Z) in the block. The block will report the acceleration in that direction in meters per second squared. Each acceleration value is roughly between -10 and 10. As an example, this code uses the x-axis of the accelerometer to control the speed of rotation servo 1. Notice that the accelerometer value is multiplied by 10 to get a value between -100 and 100, the limits of the rotation servo speed.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image12-768x271.png))

CHALLENGE

Write a program that moves the rover forward or backward using the x-axis of the accelerometer.

Click Here to see example code.

Using Two Accelerometer Axes

Now that you are using the x-axis of the accelerometer to move forward and back, it would be nice to use the  y-axis to turn the rover. However, first you have to decide if the robot should be turning. You can do this based on which acceleration value is larger. If the absolute value of the x-acceleration is larger than the absolute value of the y-acceleration, then the robot should move in a straight line. Otherwise, the robot should turn.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image8-768x290.png))

CHALLENGE

Use the sample code above to write a program that moves the robot forward or backward using the x-axis of the accelerometer when the x-acceleration value is larger than the y-acceleration. Otherwise, the robot should turn left or right using the y-axis of the accelerometer.

Click Here to see example code.

Rover: Compass

((vim videoid=r7cdqnrxhi wl=1))
((img class=img-responsive src=))

In this module, you will learn to use the compass that is on the micro:bit to make your robot move in a particular direction. 

The compass tells you the direction of your micro:bit relative to magnetic north. You can make your rover drive north while avoiding obstacles!

Calibrating the Compass

Before you use the compass, you need to calibrate it in BirdBlox. To do this, tap the Calibrate Compass button on the Settings menu.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image7-768x432.png))

Tap the name of the Hummingbird Bit, and then follow along with the video to move your Bit around in different directions to calibrate it. You should see a green check by the Bit name when you have successfully calibrated. If you see a red X, try again.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image5-768x432.png))

The Bit Compass Block

Once you have successfully calibrated, you can use the Bit Compass block on the Robots menu to read the value of the compass.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image24.png))

The compass value will be between 0° and 359°. 0° corresponds to the direction of magnetic north. The angle increases as the robot turns clockwise, so 90° is east, 180° is south, and 270° is west.

To use the compass, the micro:bit must be positioned so that the LED display is parallel to the ground. Otherwise, the compass will not provide useful measurements.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image14-768x649.png))

CHALLENGE

Write a program that continually displays the value of the compass at the bottom of the tablet screen. Watch this value change as you slowly turn the rover.

Click Here to see example code.

Displaying Direction

You can use the compass to make the rover tell you the direction it is heading in. 

For example, if the value of the compass is between 45 and 135, use the Display block to print “East” on the tablet screen.

You can use the and block on the Operators menu to combine comparisons. The and block will be true only when both Boolean blocks inside it are true.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image10-768x463.png))

CHALLENGE

Add a second if else block to your script as shown. Modify the nested if else to show “South” when the value of the compass is between 135 and 225.

Click Here to see example code.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image15-768x571.png))

Driving with the Compass

You can also use the compass to make the rover move in a particular direction. For example, this code makes the robot turn clockwise when the compass is less than 180° and counterclockwise otherwise. Try placing the rover in different positions before running this script. Which direction does the rover drive in?

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image6.png))

CHALLENGE

Modify your program so that the robot drives south as long as there is no obstacle in the way. When the robot encounters an obstacle, it should back up and turn.

Click Here to see example code.

Rover: Line Tracking

((vim videoid=4yigib6d22 wl=1))
((img class=img-responsive src=))

In this module, you will learn to use an LED and a light sensor to enable the rover to track a line.

Making a Line Tracking Sensor

You will use a single color LED and a light sensor to create a line tracking sensor. To track a black line on a light-colored surface, you need to know whether the sensor is over a black surface or a white surface. You can determine this by measuring the amount of light reflected by the surface. A white (or light-colored) surface reflects a lot of light, while a black surface reflects very little light.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/linetracking-schematic-768x475.png))

In addition to a single color LED and a light sensor, you will need a piece of cardboard that is roughly 8 cm by 15 cm and a metal brad.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/build1-768x564.png))

Poke holes in the cardboard so that you can mount the LED and the light sensor close together along one of the long edges of the cardboard. Use the metal brad to hold the light sensor in place.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/build2-768x534.png))

Glue the piece of cardboard to the bottom of the rover’s rotation servos, the LED and the light sensor should be pointing at the ground and 1-2 cm away from the ground.

Connect the single color LED to LED port 1 and the light sensor to sensor port 2.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/build3-768x283.png))

Making a Line to Track

To create a line to track, you will need large sheets of white paper and black electrical tape about 2 cm wide. Use the tape to make a black line on a white background. Avoid sharp turns; it is easier for the rover to follow gradual curves.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2019/12/image1-7-1.png))

Basic Line Tracking

To track a line, the rover should turn right or left based on whether or not it detects the line. Let’s think about tracking the left side of the line as the rover moves clockwise around the loop. When the line sensor is over the black line, the rover should turn left. When the line sensor is over the white line, the rover should turn right. 

Notice that this sample code uses the rotation servos to turn using only one wheel at a time. This means that both turns move the robot slightly forward. As the program repeats the if else block over and over, the rover will follow the line as it turns back and forth. 

Note 1: As you run a BirdBlox program, the app relays commands over Bluetooth to the robot. There is some delay in this process, and that means that you need to turn slowly to track the line.

Note 2: Rotation servos can vary a lot, so what is a slow speed for one motor may not be for another motor. For example, in the sample code one motor is running at 20% while the other runs at -50%.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/IMG_0150-768x871.png))

CHALLENGE

Try out this code. You may need to adjust the line sensor threshold and the turning speed of each rotation servo in order to track your line. The Display block will show you the light sensor value so that you can choose a good threshold.

More Line Tracking

You can combine line tracking with other robot behaviors to make more complex programs! For example, the robot can track the line only until it finds an obstacle or hears a loud noise.

CHALLENGE

Write a program that makes the rover track a line but stops the rover when there is an obstacle in front of it.

Click Here to see example code.

Flower: Sensor Control

((vim videoid=bf4cw06uch wl=1))
((img class=img-responsive src=))

In this module, you will write BirdBlox programs to control a robotic flower. You will need a flower for this module, so use these instructions to build one if you haven’t already.

You should also connect a dial sensor to sensor port 1 for this module.

Note: The flower modules assume that you have already completed the modules in the Inputs and Outputs sections.

The Dial Sensor

You will start by using the Bit dial sensor to control the LEDs.

A convenient way to see the value of the sensor is to use the Display block on the Tablet menu. Use a forever loop to continually display the value of the sensor on the screen.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image13-2.png))

CHALLENGE

Use the dial to control the brightness of the single color LEDs.

Click Here to see example code.

Math Blocks with the Dial

You can also use the math blocks on the Operators menu to change the behavior of your program. For example, this program will also make tri-color LED 1 gradually change from blue to red as you turn the dial from 0 to 100.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image8-4-768x397.png))

CHALLENGE

Modify your project as follows:

  • LED 2 should go from fully on to fully off as you turn the dial from 0 to 100.
  • Tri-color LED 2 should change from red to blue as you turn the dial from 0 to 100.

Click Here to see example code.

The Accelerometer

You can also use the accelerometer to control how much the flower blooms. 

The micro:bit accelerometer measures how much the micro:bit is tilting in three different directions, which are called x, y, and zThe value of the acceleration is between -10 m/s2 and 10 m/s2 for each direction. 

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image1-4.png))

You can measure the acceleration in the x, y, and z directions using the Bit Accelerometer block on the Robots menu.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image5-3.png))

CHALLENGE

Write a program to see the x-value of the accelerometer change as you tilt the Hummingbird in different directions. For an extra challenge, display the y– and z-values of the accelerometer as well.

Click Here to see example code.

Math Blocks with the Accelerometer

The x-value of the acceleration is between -10 and 10.  To make the flower bloom, we want to use this value to calculate an angle for the position servo. 

For example, if we calculate the angle by multiplying the x-acceleration by 4 then as the x-value of the acceleration changes from 0 to 10, the angle will change from 0° to 40°.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image7-4-768x521.png))

CHALLENGE

Adjust the program so that the flower fully blooms as you tilt the Hummingbird Bit to the left (so that the sensor ports are toward the table and the LED ports point toward the ceiling).

Click Here to see example code.

CHALLENGE

The flower doesn’t bloom when you tilt the Bit to the right because the micro:bit x-acceleration is less than 0. How can you make your flower bloom when you tilt the Bit to the right or left?

Hint: You can do this using an if else block or a block from the Operators menu.

Click Here to see example code.

Flower: Control with Variables

((vim videoid=bf4cw06uch wl=1))
((img class=img-responsive src=))

In the previous module, you used the dial and the micro:bit accelerometer to make the flower bloom and its lights dim, brighten, and change colors. 

In this module, you will program the flower to do these things automatically.

The repeat Block

You have been using forever loops to repeat blocks. You can also use the repeat block on the Control menu. 

This block repeats whatever is inside it a certain number of times. 

For example, this code will make an LED turn on and off 10 times.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image2-4.png))

CHALLENGE

Write a program to make the flower open and close 5 times.

Click Here to see example code.

Loops with Variables

To make the flower bloom gradually, you will use the repeat block with a variable. A variable is a name that represents a value. You can use it to store information.

Go to the Variables menu and click Create Variable. Name your variable count.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image21-3-768x432.png))

You will notice that the Variables menu looks different now. It contains a block for your variable and blocks to change its value.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image3-4-768x432.png))

CHALLENGE

Try out this code and watch the value of count. What does the change by block do? How does the value of count at the end of the script depend on the number in the repeat block?

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image4-3.png))

Loops with Variables

Make your flower bloom gradually using  the repeat block and count. Set the number in the repeat block to be the “full bloom” angle for your flower (yours may be different than 90°). Each time through the loop, set the position servo to count and stop briefly. You can vary the length of the wait to make your flower bloom more slowly.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image16-2.png))

To make the flower bloom repeatedly, place the code inside a forever loop.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image17-3.png))

CHALLENGE

With one repeat block, the flower blooms gradually and then closes quickly. To make the flower close gradually as well, add a second repeat block. Make the angle of the servo go from 90° to 0° by changing count by -1.

Click Here to see example code.

Adding Loops

You can also use a variable to change the color of the tri-color LEDs. 

Add a second variable and a second forever loop with a repeat inside. To make the LED change from green to red, use a subtraction block to make green decrease from 100 to 0 as red increases from 0 to 100.

((img class=img-responsive src=https://learn.birdbraintechnologies.com/wp-content/uploads/2020/10/image9-4-768x461.png))

CHALLENGE

Add two more repeat blocks to your tri-color LED script. Make the LED change from green to red, then red to blue, then blue back to green. Make the program repeat this sequence until you press the stop button.

Click Here to see example code.

CHALLENGE

Add tri-color LED 2  and the single color LEDs to your code. Make tri-color LED 2 gradually change color in a different sequence from tri-color LED 1.

Click Here to see example code.

Back to Top