a1tD00000088Bx7IAE

Course: Engineering Design with LittleBits Code Kit
4) Variables

  • 6-12 grade
  • Beginner

Lesson Description:

Students learn about variables and then apply it to their code to…

  1. Create a program using variable blocks that has the LED Matrix display an image, and when the input is on the image’s placement changes.
  2. Create a program using variable blocks that has the LED Matrix display a pixel that moves one pixel over whenever input is on.
  3. Create your own goal using variable blocks and program the LittleBits to reach that goal.

image description

Lesson Modules


Teaching Tips:

This lesson will take about 2 hours to complete. You may have to split the lesson into multiple classes.

Many of the activities in these lessons exist in the tutorial section of the LittleBits Code Kit App. These tutorials show the students EXACTLY how to set up their code. If students do this then they are not problem solving and learning how to program. Try to reduce the risk of students using the tutorial page to build their program.  You can tell if the students are using the tutorials or not by looking at the top left of their screen. If it says “Blank Canvas” they are most likely doing it themselves. If it says anything else, it is likely they are using the tutorial.

If this is what is shown on the top left of the students' screen then they are making their own project.If there is any other name in the upper left hand of the students' screens then they are using a tutorial and are likely not creating their own project.



Materials:

·         One LittleBits Code kit per group (suggestion: 2-3 students per group)

·         One computer for each student group

·         Teacher computer

·         Internet connection

·         Projector

 

Preparation: Prepare the class view to already have completed step 4 of the observation activity set up.  (see below for directions)


Observation activity:

For this activity you will just show and follow the directions on the LittleBits Code Kit on the screen for your students to see. WARNING: Many of the activities the students are completing are set up as tutorials on the app. (As you will see) the tutorials tell the students exactly what to do to reach the goal (which does not help them learn). A suggestion would be to set up the tutorial page to THIS page BEFORE projecting your screen to the students as opposed to the menu page to reduce the chance students would use the tutorials to reach their goals versus problem solving themselves.

Try to only show your screen when you reach THIS point






How to access tutorial for observation activity:

1)      Open the LittleBits Code Kit app

2)      On the top left of the screen click “Code Tutorials”

3)      Scroll down to “Code Tutorial 4.0 Variables”


4)      Click on “4.0 Birthday Countdown”

5) Project your screen


6)Follow the directions on the screen.

If needed, have students move closer to the screen and LittleBits so they can better see and hear.

You will then follow the directions in the tutorial for “Birthday Countdown”. Since this project includes the speaker, be aware of how loud it can get and how sensitive the volume slider is. A good strategy would be to set it at the lowest and then very slowly continually run the program and raise the volume.



Have students go to their computers and answer the question(s)

1.      How would you describe a variable block?

2.      What is the benefit of using variable  blocks?

Once all of the students have submitted their responses have a class discussion about what they observed.

In this section we will add a variable block to the program and observe and discuss its purpose. 


How would you describe a variable block?

What is the benefit of using variable blocks?


Teaching Tips:

1)      Show the students’ goals on the class view.

2)      Let them know that today we are going to begin learning about variable blocks.

3)      Show the students the “Code Kit Tutorial 3: Variables” video on the class view

4)      Show the video game bars image on the class view. And tell the students that variables are used a lot in video games. Ex: score, character movement. Have students fill in the blanks for the score variable. Their response might look something like this: 

Variable: health

At the beginning of the same set the character’s health to 20.

 

If [bitten by a zombie] happens

Subtract 1 from health

 

If [coin is collected] happens

Add 1 to health

 

5) Show them the next image of the LED Matrix with XY plane on it. Explain that coding the LED matrix works through coordinates through an XY plane. Explain the image to the students

6) Now check if the students understand by having them answer the questions on their computers. If you click the button on the bottom right of each question"Show Results", their responses will be shown as a graph.


Answers:

1) (2, 1)

2) (0,7)

3) (6,6)


7) Have students then do a similar activity with the movement of a character, but this time have them use the image blocks as the output.


Here is an example


Variable: Character

If / signal from [In1] is on

Do / rotate character by 90


If / signal from [In2] is on

Do /  move character up by 1


If / signal from [In3] is on

Do / move character down by 1

In this section we will begin exploring the the ways in which variables are integrated into programs.


What coordinates is the red #1 square at?
  • (1,2)
  • (2,1)
  • (3,2)
  • (2,3)

What coordinates is the red #2 square at?
  • (0,7)
  • (7,0)
  • (1,7)
  • (7,1)

What coordinates is the red #3 square at?
  • (7,6)
  • (6,7)
  • (7,7)
  • (6,6)


Teaching Tips:

GOAL 1

Show the students’ first goal on the class view: Create a program using variable blocks that has the LED Matrix display an image and when input is on, the image’s placement changes.

During the design time, walk around and prompt your students with questions to help deepen their learning and thinking process. Some examples of questions are:

  • Why did you make that design decision?
  • What do you predict your code will do?

Here is an example of a working code for this goal:



GOAL 2

Show the students’ second goal on the class view: Create a program using variable blocks that has the LED Matrix display a pixel that continually moves one pixel over whenever input is on.


Go to the next section on the class view to show the loop blocks. Have the students discuss in their groups - which loop block(s) do you think you will need to use in order to reach this goal? Explain why.

During the design time, walk around and prompt your students with questions to help deepen their learning and thinking process. Some examples of questions are:

  • Why did you make that design decision?
  • What do you predict your code will do?

Here is an example of a working code for this goal:






CHALLENGE GOAL 3

Present the challenge goal on the class view.

Create your own goal using variable blocks and program the LittleBits to reach that goal.

Have students submit their goals as a response to a question on the student view.

During the design time, walk around and prompt your students with questions to help deepen their learning and thinking process. Some examples of questions are:

  • Why did you make that design decision?
  • What do you predict your code will do?

In this section we will practice using variable blocks in order to reach the goals and challenge goal.

LittleBits Blockly Key



Little Bits Code Kit Reference


Create your own goal using variable blocks and program the LittleBits to reach that goal.


What is your goal?


Teaching Tips:

Have students answer the following questions on their computers. Once all the students have finished answering the questions have a class discussion about their answers. 

  1. Explain how variable blocks work.
  2. What was the most challenging part of using variable blocks? What strategies did you use to overcome this challenge?
  3. What is the coolest thing about coding with variable blocks? Explain why.


In this section we will be reflecting on our learning of variable blocks. 


Explain how variable blocks work.

What was the most challenging part of using variable blocks? What strategies did you use to overcome this challenge?

What is the coolest thing about coding with variable blocks? Explain why.