• Home
  • Getting Started
  • Beginning Lessons
    • Lesson B1 Moving Robot
    • Lesson B2 Turning
    • Lesson B3 Make a Shape
    • Lesson B4 Draw Shapes
  • Output Lessons
  • Sensor Lessons
  • Advanced Lessons
  • Facilitator lesson plans
    • Registration
  • Resources
  • EPIQ2025
QuorumRobotFinch
  1. You are here:  
  2. Home
  3. Output Lessons
  4. Lessons Plans & Code
  5. OutPut Lessons

OL2Tail

This is a multi part lesson where the same code is reused with additions and a few subtractions. The tail is 4 led lights at the back of the robot just in front of the microbit display. It use RGB parameters that are used with the beak light and one more parameter that tell which of the 4 lights you want to use. 

OLTail1 (copy Beak2 and paste it into a new project)
Block Code Image for Tail1

use Libraries.Robots.BirdBrain.Finch
Finch finch
repeat 3 times
finch:SetTail("All",100, 0, 0)
finch:Pause(0.5)
finch:SetTail(1, 0, 100, 0)
finch:Pause(0.5)
finch:SetTail(2,0, 0, 100)
finch:Pause(0.5)
finch:StopAll()
end
finch:Disconnect()

You can change your code by replacing old code with just a few clicks. In the Edit Menu you will find Replace or use CONTROL H. If you copied the Beak=2 code in to your new project you would want to replace SetBeak with SetTail. Use the replace all choice and changes all of this at once. 

You need add a another parameter that tell the robot what light you want to use. There are 4 lights 1,2,3, and 4. This goes in the first spot. You can also use text "All" in the first spot to effect all 4 lights at the same time.  Text must be inside of "parentheses marks". 

OL2Tail2
use Libraries.Robots.BirdBrain.Finch
use Libraries.Compute.Random
Random random
Finch finch
integer r=20
integer g=20
integer b =30
integer l=4
repeat 25 times
finch:SetTail(l,r, g, b)
//finch:Pause(0.05)
finch:StopAll()
l=random:RandomInteger(3)+1
r=random:RandomInteger(100)
g=random:RandomInteger(100)
b=random:RandomInteger(100)
end
finch:Disconnect()

New: Variables, random and comments.
We are going to make four integer variables, one for the number of the lamp to be lit and three for the different color values. The first time you name a variable, you need to preceded it with the type, this time they are integers. Variables can also be numbers, text, or  true/false. We will need to use another use statement: Libraries.Compute.Random and then create another action named random. 
We are going to make use of random to create the number of the lamp we want to light and  RGB percent for each of the three colors. The higher the number, the brighter that component of the LED light will be brighter.
the variable l (L)  is to choose which of the 4 light we going use. RandomInteger will pick an integer between 0 and the number we choose. As the only valid integers for l are 1,2,3,&4. to make this happen we set the (3) and add 1 one. This avoid getting a zero. 

the // (two slash marks) in line 11 mean to ignore this line. That is how we make a comment that does not effect the code, To make the flashing go slower just delete out the // and the pause will happen.

 

Samples of all the color Codes

OL1Beak

This is a multi part lesson where the same code is reused with addions and a few subtractions. The beak is the a single light at the front or nose of the Finch. 

Block Code Text Code for Copy and Paste

 Notes

Beak1
use Libraries.Robots.BirdBrain.Finch
Finch finch
finch:SetBeak(100, 100, 100)
finch:Disconnect()

Color Parameters

  • Red intensity (Range: 0 to 100).
  • Green intensity (Range: 0 to 100).
  •  Blue intensity (Range: 0 to 100).
    Once you have run this code try changing the integers (SetBeak (0,100,0) makes green. What other colors can you make. 
Beak2
Block code Beak 2
use Libraries.Robots.BirdBrain.Finch
Finch finch
repeat 3 times
finch:SetBeak(100, 0, 0)
finch:Pause(0.5)
finch:SetBeak(0, 100, 0)
finch:Pause(0.5)
finch:SetBeak(0, 0, 100)
finch:Pause(0.5)
finch:StopAll()
end
finch:Disconnect()

This code makes the beak blink Red, Green, Blue.
Pause make each blink last half a second.
StopAll turns off all the lights,
repeat makes the whole process happen 3 times. 

Explore what other light effects you can create.

 

Beak3
Block Code Image Beak 3
use Libraries.Robots.BirdBrain.Finch
Finch finch
integer r=0
integer g=100
integer b =100
repeat until r=100
    finch:SetBeak(r,g,b)
    r=r+5
    g=g-5
    b=b-3
    finch:Pause(0.3)
end
finch:Pause(2)
finch:StopAll()
finch:Disconnect()

New: we are creating integers that change by addition  and subtraction while the program runs.

At the start red (r) is zero green (g) and blue (b) are 100. Then we create a loop that repeats until r = 100. Once r is 100 it skips down to the end and does the remain code. Each we loop we add 5 to r, subtract 5 from g, and subtract 3 from b. 

Feel free to change up the code to make a beak light show.  REMEMBER: r,g,b must be a whole number between 0 and 100. If you change the formulas and it create a a number that less than 0 or greater than 100 it will fail! 


Table of ColorCodes(X,X,X)
Colors with text names (Wikipedia)

Output Lessons plans for Facilitators

OL3Display

This is a 5 by 5 grid of small lights that are in the tail of the Finch. You can send letter number words and shapes.

DISPLAY 1 TEXT
Block Code for Display Text use Libraries.Robots.BirdBrain.Finch
Finch finch
finch:Output("HELLO")
finch:Disconnect()
Very short code that will send text to the microBit display in the tail of the Finch. 
the new action is Output. Any letters or numbers in the parameter() and enclosed in double quote marks " " will be displayed one character at a time on the display. 
Create your own clever messages for your robot to display. 

You also can choose exactly which of the 25 lights you would like to turn on or off. This is an an example of binary or one and zero code. One means the light is on zero means the light is off.

Display2    
Block Code of Display2Dots use Libraries.Robots.BirdBrain.Finch
Finch finch
//Display a smiley face on the micro:bit LED array
finch:SetDisplay("0000001010000001000101110")
finch:Disconnect()

This grid shows what light you want to turn on 7 & 9 are the eyes so the 7th and 9th spots should be 1. How would make a frown?

There is a 26th light on the display. It is always on when the robot is on. It is to the top right of the display.

OK now it is your turn.  Can you make a Square shape on the display.   An answer is on the Challenge Hints and Answers page

Here is an image that may help you 
Grid Show Display Square.

OM-More Motors

Add Lights and Sound while you make the Robot move.

  • OM1 Forward and Back with Lights
  • OM2 Add speech the OM1
  • OM3 Make a Circle
  • OM4 Speed Test
  • OM5 Spiral Challenge
  • OM6 Square Spiral Challenge

Now you know something about motors and lights let give you a challenge that uses those actions in a loop.

Task :Make the robot move forward and back 4 times. When the robot moves forward make the Beak Light Green, When moves backward make the tail lights Red. Remember to turn off the light when you are ready to got the other direction. 

One possible solution is below but try it on your own first. 

 

OM1 Motor and Lights Text Code for Copy and Paste Notes
Block Code for OM1 Motor & Lights use Libraries.Robots.BirdBrain.Finch
Finch finch
repeat 4 times
finch:SetMotors(50,50)
finch:SetBeak(0, 100, 0)
finch:Pause(1)
finch:StopAll()
finch:SetMotors(-50,-50)
finch:SetTail("All",100, 0, 0)
finch:Pause(1)
finch:StopAll()
end
finch:StopAll()
finch:Disconnect()

Is your code different or the the same as the sample? If does what we asked the robot to do, then it is a successful code. Our code was 14 lines long. It is possible to do this task in 13 lines. Which line do you think was unneeded?

(Line 13, we had already stopped everything in in the last repeat of line 11!)

As a computer programer we want our code to be no more complicated than it needs to be. 

OM2MotorSpeech Text Code for Copy and Paste Notes
Block Code for OM2 speech use Libraries.Robots.BirdBrain.Finch
Finch finch
repeat 4 times
say "Forward"
finch:SetMotors(50,50)
finch:SetBeak(0, 100, 0)
finch:Pause(1)
finch:StopAll()
say "BACK"
finch:SetMotors(-50,-50)
finch:SetTail("All",100, 0, 0)
finch:Pause(1)
finch:StopAll()
end
finch:StopAll()
finch:Disconnect()

This code is the same as the past program except for 2 line. The say command is apart the basic Quorum program. The robot does not have the ability speak on it's own. But when you run the code your computer will speak. 

say "any words you want" any text you you in the quotemarks will be spoken. 

OM3 Motor Circle Text Code for Copy and Paste Notes
use Libraries.Robots.BirdBrain.Finch
Finch finch
finch:SetMotors(1,50)
finch:Pause(2.9)
finch:StopAll()
finch:Disconnect()

A Short code with a lot going on.
Line 3 has two numbers. The first number is the speed of the left whee, and the 2nd number is the speed of the right wheel. The number in the Pause (line 4) tells the robot how long to turn the wheels before stopping. On the test robot moving on a white board these numbers worked to make a 10cm diameter circle.  

What numbers would you need to change to make the robot go clockwise? can you make small or larger circles?

This is a good activity to use your colored pens. 

 

Lets find more about the speed of the robot. We are going to make a simple code, Make changes to the speed each time we run the program and like good scientest we will record the data we make and even create a Graph

OM4 SPEED TEST Block Code Text Code for Copy and Paste Notes
BlockCode OM4 use Libraries.Robots.BirdBrain.Finch
Finch finch
number speed=10
finch:SetMotors(speed,speed)
finch:Pause(1)
finch:StopAll()
finch:Disconnect()

Create a chart like the one below. 
You will change line 3 and run the code by ten each time. 

1 does not move the wheels.  Do this 10, 20, all the way to 100. Using the pen will make it easy to then measure each line created. If you have a big paper you can use the line as a graph!

Test Robot Data

SetMotor Distance Travels seconds Speed CM per second expect from base of 7
1 0,0,0 no movement 1 0 no movement  
10 7,7,7 1 7cm/sec 7
20 14,14,14 1 14cm/sec 14
30 21,21,21 1 21cm/sec 21
40 24,24,24 1 24cm/sec 28
50 30,30,30 1 30cm/sec 35
60 38,38,38 1 38cm/sec 42
70 41,41,42 1 41cm/sec 49
60        

What does the data tell us. It the case of the test robot on a slick white board it does not achieve the expect speed starting At motor speed 40. My hypothesis is that at  speeds above 30 there is a 4 unit of slippage or spinning of the wheels before they engage due to the slick surface.  How could we test this hypothesis? Was your data different? 

OM5 Spiral Challenge (Answer below)

Your task is to make your robot draw a spiral. 

OM5 Spiral Block Code Text Code for Copy and Paste Notes
BLOCK CODE for OM5 Spiral use Libraries.Robots.BirdBrain.Finch
Finch finch
number left = 50
number right = -20
repeat 80 times
finch:SetMotors(left,right)
right=right+0.5
end
finch:StopAll()
finch:Disconnect()
There many ways to make your robot draw a spiral.
Keep in mind:
  • If both speed numbers are the same then the robot moves in a straight line forward for positive numbers and backward for negative number. 
  • The range of the speed is -100 to +100. 
  • 1,0,-1 all do not move the wheel.
  • These are numbers so you can use decimals (0.5 or 10.4).

Try adjusting the numbers to create small or larger spirals. 

 

OM6 Another way to move
There is another way move the robot called SetMove. It locks the wheels togather so they can only forward or backward.

finch:SetMove("forward", length, 50)

  1. text direction: The direction of movement ("forward" or "backward").
  2. number distance: The distance to travel in centimeters (Range: 0 to 500).
  3. number speed: The speed as a percent (Range: 0 to 100).

This if often used with the SetTurn command, length 

finch:SetTurn("left",90,50)

  1. text direction: The direction of the turn ("right" or "left").
  2. number angle: The angle of the turn in degrees (Range: 0 to 360).
  3. number speed: The speed of the turn as a percent (Range: 0 to 100).

    The following code will make a square spiral moving inward.
OM6 Square Spiral Block Code Text Code for Copy and Paste Notes
use Libraries.Robots.BirdBrain.Finch
Finch finch
number length =25
repeat 10 times
finch:SetMove("forward", length, 50)
finch:SetTurn("left",90,50)
length=length-2.5
output length
end
finch:StopAll()
finch:Disconnect()

The output shows you the number that is the length in centimeters that the robot just moved in the consol on your computer. 
In SetMove the distance can not be a negative number. If you want robot to go backwards you need to use the text "backward". 

Can you make your robot make the same shape from small to large? 

 

 

OS Playing Sounds

Make sound and Music with your Finch. 

OS1 All the Notes Text to Copy Notes
use Libraries.Robots.BirdBrain.Finch
Finch finch
integer n=31
number l=1.0
repeat 104 times
n=n+1
finch:PlayNote(n,l)
end
finch:Disconnect()

The sound of the Finch is not loud or high quality.  The Finch 2.0 understands MIDI (Musical Instrument Digital Interface)  and the first  perimeter tells how high or low a note will be. This integer should be between 32 and 135.

The second parameter is for how long the note should be in time.

In line 4 and line 7 there is a variable named "l" (lower case L) It looks a lot like the number 1. Perhaps we should have used the "d" for duration.

There are 104 different notes that the robot can play that's why we repeated 104 times.

 

Next we have the Robot Play a "C" scale starting on middle C. Middle C is MIDI number 60. 

OS2 C Scale Text to Copy Notes
use Libraries.Robots.BirdBrain.Finch
Finch finch
number d=1
finch:PlayNote(60,d)
finch:Pause(d)
finch:PlayNote(62,d)
finch:Pause(d)
finch:PlayNote(64,d)
finch:Pause(d)
finch:PlayNote(65,d)
finch:Pause(d)
finch:PlayNote(67,d)
finch:Pause(d)
finch:PlayNote(69,d)
finch:Pause(d)
finch:PlayNote(71,d)
finch:Pause(d)
finch:PlayNote(72,d)
finch:Pause(d*2)
finch:Disconnect()

The device that makes the sound on the finch robot is very small, it is more like a buzzer than it would be like a speaker. You may notice that some of the notes are louder, and some softer, Different Finch robots will have slightly different loudness levels on any particular note.

In the instructions from the company that makes the finch it says that the duration of 1 should be one second. We have found that this is not the case and the duration is much shorter. For that reason, we have inserted a pause with the variable d. You can change variable d to make the notes have different duration.

Here is a chart of all the MIDI NoteNames on the Finch! Finch MIDI codes. 

 

Now we will make the robot perform a chromatic scale. Let's start on the C above middle C (MIDI 72) and go 13 half steps ending on the next higher c. to go higher you will want to increase by just one MIDI number. Hint: The first code in sound OS1 played the whole chromatic scale that is possible to play on the Finch, 

Below is a possible solution. 

OS3 Chromatic Scale Text to Copy  
use Libraries.Robots.BirdBrain.Finch
Finch finch
integer n=72
number d=1.0
repeat 13 times
    n=n+1
finch:PlayNote(n,d)
    finch:Pause(d)
end
finch:Disconnect()
There are 12 different sounds in the chromatics scale. The 13th is a repeat of the first note name one octave higher. 72 is the midi note for the C above middle C.

 

SO4 Beeps    
Block code for OS4 beeps use Libraries.Robots.BirdBrain.Finch
Finch finch
//low beep
finch:PlayNote(55,0.1)
finch:PlayNote(48,0.1)
finch:Pause(2)
//high beep
finch:PlayNote(80,0.1)
finch:PlayNote(84,0.1)
finch:Disconnect()
You can use the PlayNote() to insert beeps in to your robot programs. experiment with different midi numbers to find the ones that sound best to you. Every Finch robot has it's voice.  

 

You can find more music codes in the advanced lessons.

  1. Lights
  2. Output Lessons
  3. OutPut Lessons

Main Menu

  • Home
  • Getting Started
  • Beginning Lessons
    • Lesson B1 Moving Robot
    • Lesson B2 Turning
    • Lesson B3 Make a Shape
    • Lesson B4 Draw Shapes
  • Output Lessons
  • Sensor Lessons
  • Advanced Lessons
  • Facilitator lesson plans
    • Registration
  • Resources
  • EPIQ2025

Login Form

  • Forgot your password?
  • Forgot your username?
  • Create an account
Copyright © 2025 QuorumRobotFinch. All Rights Reserved.
Joomla! is Free Software released under the GNU General Public License.


This site is not apart of the Quorum Language group or BirdBrains Inc.
Tim is thankful for those groups efforts to advance education.