Magic Robo-Flashlight

Imagine a situation, in which you lost one very important book under your bed. But it is very dark under there, and maybe some monsters even live there (just joking)! What device would you use to light up the space under the bed? Can we build this device using Robo’s blocks?

1 Build

Let’s decide what blocks we need to build a Robo-Flashlight. Think of a flashlight, what are its parts? What does a flashlight do? Can it be switched on and off? Can you maybe even draw a sketch of a flashlight? Here is our idea:

Blocks you will need:
Step 1
Step 2

2 Code

Our magic Robo-Flashlight is built, but how did we get it to glow? In order to make a robot do anything, we have to give it the right instructions — by creating some code.

Do you feel like you need to refresh some Robo Code App basics before making the project? Check out our How-to-Code tutorial here.

We want to code our flashlight to do the following:

  • A flashlight is off until you click the button
  • The button is clicked
  • The flashlight turns on once the button is clicked. You should now see the glow of the flashlight.
Step 1

Open the Robo Code App, connect to your robot & create a new project.

Step 2

Drag and drop two Constant Light Actions on the Coding Screen.

Step 3

Change the setting for the first Constant Light Action to 0 brightness; this means the light will be off. Choose any color you want for the second Constant Light Action, this will be the color of your magic Robo-flashlight.

Step 4

The flashlight should turn on and off when you click the Button. We need to instruct the robot to wait for our command. So let’s set the Lifespans for both of the Constant Light Action to infinite. This means that the robot will wait forever (infinite) for you to click the button.

Step 5

Connect the Constant Light Actions into a Loop, this means that our flashlight will be working all the time.

Step 6

What is missing? The Button Trigger! This trigger gives the robot the instructions to turn the light on and off when the red button is pressed. Let’s add the Button Trigger on both Connections, so we can switch our flashlight on and off.

Are we ready to test it out? Yes! Press Play to try out your code, press on the Button to switch your flashlight on/off.

Now we can use our flashlight to find the book that’s under our bed without being afraid of any monsters. Great work!

Reflect
  • What did we just create? 
  • Why did we need a flashlight? 
  • Why does the flashlight have a Button? What’s its function? Can you think of other devices that have buttons? Do all these buttons work in the same way? 
  • Can you create another device from RW Blocks that also have a Button?
Challenges
  1. Click - Click!!! Code your magic Robo-Flashlight to switch ON/OFF only if you click on the Button twice.
  2. Make it smart! Code your magic Robo-Flashlight to be ON if you press and hold the Button and OFF if you realise the Button.
  3. Rainbow-Flashlight! Code your magic Robo-Flashlight to change between 7 rainbow colors every time you click on the Button.

(You can find the answer key to these challenges at the end of the page).

3 Play

Here are some games you can play with your magic Robo-Flashlight.

Game 1: Constellation Flashlight

Create your own starry sky in your room! Use some black paper or card stock and draw stars on it. Cut these stars out using small scissors. Be careful while using the scissors! Turn the flashlight on and attach your card to it. Enjoy the starry sky!

Here is a great tutorial on how it can be done. And another one here

Game 2: Shadow Theater

Create your own shadow theater and perform your favorite story.

Here is a great tutorial on how it can be done:

Game 3: Hide and Seek in the Dark

Play this one with your friends! The rules are the same as for a regular hide and seek but just in the dark. Use your magic flashlight to become a detective who finds everyone!

Think of another game where you can use your magic Robo-Device!

Learning outcomes

STEAM & Project Based Approach

Imagine that you are going to do a project and you think: What will I learn at the end? Here are the learning outcomes formulated from “I” perspective:

  • Engineering: I know what a push-button is and how devices with buttons work. I can combine RW blocks to build a flashlight.
  • Computer Science: I can create a simple program that includes Actions, Loop and Conditions.
  • Design Thinking: I can analyze a challenge, come up with a solution, build, code and test this solution, reflect on this solution. 
  • Creativity: I can create an interesting and creative solution. I then use this solution in different ways such as games. 

Answer key

1. Click - Click!!!

Use the same code. Change the settings for both Button Triggers to “Clicked 2 times”. Done! Press Play and see how quickly you can click 2 times!

2. Make it smart!

Use the same code. Change the settings for the first Button Trigger to “Pressed” and the settings for the second Button Trigger to “Released”. Try out!

3. Rainbow-Flashlight!

Start a new project. Drag & Drop 7 Constant Light Actions to your coding screen. Set their colors to rainbow colors in the order of the rainbow (for example: red, orange, yellow etc). Now set the Lifespan to infinite for each Action. Connect them all into the Loop. Now add the Button Triggers to all 7 Connections. Push the button and your Rainbow-Flashlight is ready to glow!


Congratulations!

You've completed the Magic Robo-Flashlight! How was your experience? We would love to hear your feedback here.