A Day in the Life CTE Enrichment Grades 3-5 mblock Robotics - Simple Programs

Similar documents
A Day in the Life CTE Enrichment Grades 3-5 mblock Programs Using the Sensors

e d u c a t i o n Detect Dark Line Objectives Connect Teacher s Notes

PLEASE NOTE: EVERY ACTIVITY IN THIS SECTION MUST BE SAVED AS A WAV AND UPLOADED TO YOUR BOX.COM FOLDER FOR GRADING.

Some prior experience with building programs in Scratch is assumed. You can find some introductory materials here:

Lab book. Exploring Robotics (CORC3303)

Studuino Icon Programming Environment Guide

Scratch for Beginners Workbook

iphoto Getting Started Get to know iphoto and learn how to import and organize your photos, and create a photo slideshow and book.

The light sensor, rotation sensor, and motors may all be monitored using the view function on the RCX.

Two Hour Robot. Lets build a Robot.

Introduction to programming with Fable

Programming I (mblock)

Your EdVenture into Robotics 10 Lesson plans

EV3 Advanced Topics for FLL

Overview. The Game Idea

PowerPoint 2016: Formatting Pictures. Introduction

1. Controlling the DC Motors

For more add-on packs and building instructions, please visit:

Lego Nxt in Physical Etoys

Robot Programming Manual

Ev3 Robotics Programming 101

1. ASSEMBLING THE PCB 2. FLASH THE ZIP LEDs 3. BUILDING THE WHEELS

Let s start by making a pencil that can be used to draw on the stage.

RGB Line Follower. 1. Basic knowledge of RGB line follower

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Macro. Installation and User Guide. copyright 2012 C.T. Stump

micro:bit Basics The basic programming interface, utilizes Block Programming and Javascript2. It can be found at

understanding sensors

SINGLE SENSOR LINE FOLLOWER

LEGO Mindstorms Class: Lesson 1

Zoom Set Too Tight Zoom Set Correctly Zoom Set Too Wide

When you load GarageBand it will open a window on your desktop that will look like this:

An Introduction to Programming using the NXT Robot:

Revision for Grade 7 in Unit #1&3

Pong! The oldest commercially available game in history

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

Robotics using Lego Mindstorms EV3 (Intermediate)

Introduction to Turtle Art

Photoshop Exercise 2 Developing X

A quick overview of the basics of my workflow in. Those gaps in Photoshop s Histogram indicate missing information.

UNIT1. Keywords page 13-14

OZOBOT BASIC TRAINING LESSON 5 CODING AND GEOMETRY

Chapter 14. using data wires

Parts of a Lego RCX Robot

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13

Introduction. The basics

!!! Warhol Project Tutorial! -From the top menus choose Image>Adjustments>Threshold! -Open Photoshop and Reset your tools!

Lab 1: Testing and Measurement on the r-one

My Blogs: To Add New Blog Post: o Click on the My Learn360 link. You will then see eight different tabs (below).

EQ-ROBO Programming : bomb Remover Robot

Capstone Python Project Features

Laser Cutting at CAP Fab Lab

A - Debris on the Track

A - Debris on the Track

How Do You Make a Program Wait?

Introduction. Overview

High Speed Motion Trail Effect With Photoshop

Inverted Colors Photo Effect With Photoshop

The Joy of SVGs CUT ABOVE. pre training series 3. svg design Course. Jennifer Maker. CUT ABOVE SVG Design Course by Jennifer Maker

B&W Photos from Colour:

Where C= circumference, π = 3.14, and D = diameter EV3 Distance. Developed by Joanna M. Skluzacek Wisconsin 4-H 2016 Page 1

Programmable Control Introduction

a. the costumes tab and costumes panel

Getting Started. with Easy Blue Print

Audacity 5EBI Manual

A STARTER GUIDE OF BOSON KIT FOR MICRO:BIT

How to do automatic horizontal background scrolling in Scratch

CS1301 Individual Homework 5 Olympics Due Monday March 7 th, 2016 before 11:55pm Out of 100 Points

Chord Track Explained

Explore and Challenge:

Module. Introduction to Scratch

Chapter 4 Deciphering Strumming Patterns


Bit:Bot The Integrated Robot for BBC Micro:Bit

Arduino Lesson 1. Blink. Created by Simon Monk

ilightz App User Guide v 2.0.3

Using the SparkFun PicoBoard and Scratch

Thanks to Autocheck function, it is possible to perform a complete check-up of the robot thanks to a stepby-step

Lab 8: Introduction to the e-puck Robot

Controlling Your Robot

Practicing with Ableton: Click Tracks and Reference Tracks

Use of the built-in Camera Raw plug-in to take your RAW/JPEG/TIFF file and apply basic changes

Photoshop: Manipulating Photos

Getting started Guide

Let s start by making a pencil, that can be used to draw on the stage.

Hare and Snail Challenges READY, GO!

Songwrite 2 version 0.3 user guide

Programming PIC Microchips

Photoshop CC 2018 Essential Skills

Some Things You Don t Know Your iphone Can Do

RG Kit Guidebook ARGINEERING

Robotic Programming. Skills Checklist

Objective of the lesson

Basic 2D drawing skills in AutoCAD 2017

Pong! The oldest commercially available game in history

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

LIGHT-SCENE ENGINE MANAGER GUIDE

Strangers and Other People

Blend Photos With Apply Image In Photoshop

SIMPLE POP ART EFFECT

Transcription:

Activity 1 - Play Music A Day in the Life CTE Enrichment Grades 3-5 mblock Robotics - Simple Programs Computer Science Unit One of the simplest things that we can do, to make something cool with our robot, is the Play note command. One note is just one note, but put the right notes together in the right order and we have a masterpiece. Let s get started: First, let s play a note. Any note. I drag and dropped this block into the programming area. And then I clicked it. And there was music. Well, calling it music is a stretch of the imagination, but it played a note. So, I added another note. When I drag the second blog below the first block, the bottom of the first block turns white. This means when I drop, they will fit together. I can also change the length and pitch of the note. Here, I am changing the length of the second note: Ok, now I want more notes. For more notes, I need more of the same play tone on. block. A shortcut I can make, instead of dragging and dropping is to copy and paste. If I right click on the blocks on the programming area, it gives me a menu:

Computer Science Unit Selecting duplicate copies the blocks. Note that this will duplicate all the blocks below and including the block I clicked. So if I had clicked the bottom block, only one block would have been duplicated. As I clicked the top block, both blocks were duplicated: Now, I can add them to the end of my song: And keep developing: Ok. Now, I want to have a pause. So I need a different block. I need to wait. Under the Control Scripts, there is a wait block: I am going to add that to the end of my song, then repeat the first half with a couple of changes:

Computer Science Unit One important aspect of writing code is including comments. While they don t affect how a program runs, they are a huge help to people who read the code. This could be other people who are working on the same team as you, or you yourself, months after having initially written the code (and having forgotten some of the details). Comments should be included in all programs to guide those reading it. To add comments, right-click on the block you want to add the comment to and then select add comment : Here I have added comments to my song: Make sure that you add comments to all your programs, and update the comments where necessary if you make any changes to programs. Challenge:

Computer Science Unit 1. Do you know what the song is? Can you finish the song? Can you amend the comments to reflect the updated status? 2. Can you write the song Merry Christmas? Be sure to add comments 3. Can you write your own song? Add comments Construct Your Dreams!

Activity 2 - The LED Display Computer Science Unit There are 2 RGB LEDs on the mcore. RGB stands for Red-Green-Blue and LED stands for Light-Emitting Diode. Each LED can be assigned a level of red light, a level of green light and a level of blue light from 0 (light turned off) to 255 (light turned on full power). By combining these lights, you can make a wide range of different colors: To get playing with the on-board LEDs, I need to drag and drop this block: The first drop-down menu gives me a choice of which on-board LED I want to control. On the mbot, I have 3 choices: I want to control all the LEDs so I am going to select all. The other 3 drop-downs allow you to control how bright the LED displays the relevant color. It gives you options of 0, 20, 60, 150 and 255, but if none of those are good for you, you can also type in the value you want. I am going to set my LED s red value to 35 and click the block to see the LEDs light up. It might be fun to have the robot flashing light like a police car, going from red to blue and back again. I would like this to go on forever. Fortunately, there is a Forever block in the Control Scripts:

Computer Science Unit As you can see, the shape of this block is different to the shape of the other blocks we have seen so far. That is because this is a control block that allows the program to enter a loop. In programming, a loop is a feature that allows a part of code to be repeated. In this example, the loop is going to repeat forever, repeating all the blocks that are inside the forever loop : The LEDs will be set to red, then blue. Then the program will go back to the top of the loop, and the LEDs will be set to red again, then blue, then loop, etc, etc, forever. That is good. But the lights change color far too quick. I am going to slow them down by adding a Wait block: Notice that I need 2 wait blocks one after the red LED is turned on, and one at the bottom of the loop, where the blue LED is turned on. Challenge: 1. Play with different settings of the LEDS. What different colors can you make? What settings of the RGB LED creates these colors? 2. Can you write a program that sets the left LED and the right LED at different times to your favorite color? So if the right LED is on the left LED is off, and vice-versa. 3. Can you write a program that gives a light show that is accompanied with music? Remember to add comments

Activity 3 - Move in a Square Computer Science Unit NOTE: While following this tutorial and developing your own program, make sure that your robot is either propped up so the wheels aren t in contact with a surface, or in a space where it can move freely Please make sure it doesn t fall off any desks or tables. ANOTHER NOTE: This tutorial runs programs from the mblock IDE. It does not update any programs onto the robot board. Robots are made to move and in this tutorial, we are going to learn how. The block that controls robot movement has 2 drop-down menus. The first menu controls the direction the robot moves in: And the second menu controls power. Top power is 255, 0 stops the motors, and negative numbers reverse the direction. (NOTE: Slower power levels may not be strong enough to get the robot moving.) And the second menu controls power. Top power is 255, 0 stops the motors, and negative numbers reverse the direction. (NOTE: Slower power levels may not be strong enough to get the robot moving.) So to start, I am going to get my robot moving forward at a speed of 100: It is possible that your robot does not run perfectly straight. This could be for a few reasons such as one of the wheels not being perfectly aligned or one of the wheels being more tightly attached to the robot causing more friction. If this is the case, you could fix this by replacing the run forward block with 2 blocks setting the motor power levels separately: My robot is going straight though, so I am going to continue using the run forward block. I want to write a program that moves in a square. So let s go forward for one

Computer Science Unit second, then turn right. I want to turn right until I have turned 90 degrees. I m going to first try turning for one second and then see if that s too far or not far enough: Can you see why this did not run as I wanted? If you can t see, why not try running this code yourself before reading on? The robot runs the program and then finishes. The penultimate command is to turn right. Then the robot waits for one second. Then the program ends. At no point in the program are the motors turned off. So the motors keep running. I need to add a line to stop the motors: Ok, my robot moved a little too far. As I want to test how far to turn, and that is unrelated to the part of the code that moves forward, I am going to isolate the turning part of the code. This will make testing easier and faster: After a few tests, I found that my robot needs 0.65 seconds to make a 90 degree turn. The time it needs to turn 90 degrees depends on many things. For example, what kind of battery you are using, how charged the battery is, how much friction there is between the motor and the wheel, and the speed setting of the turn will all

Computer Science Unit affect the time needed to turn 90 degrees. So, when you do your tests, it is more than likely you will get a different number. I need to go forward and turn 4 times to make 4 sides. There is a repeat block I can use to make a loop. Put all the things you want to be repeated inside the repeat block: And change the number of repeats to 4: Challenge: 1. Do I need the last movement command in my repeat loop? Can you make the code more streamlined so it still does what we want, but with less commands issued? 2. Can you write a program that moves the robot in a rectangle? 3. Can you extend your program from question 2 to write a program that gives a warning sound before starting, and has lights on while moving? Construct Your Dreams!

Activity 4 - Move in a Circle Computer Science Unit Sometimes we don t want to move in a straight line or perform a point turn (as the turn left / turn right commands do). In this case we can use the set motor block: We can choose a motor (M1 left, M2 right) and a power level (negative powers move in reverse). In this way, we can perform swing turns (where one motor is turned off and the other is on): Or we can move in circles: Challenge: 1. Write a program so your robot moves in a figure-of-eight. 2. Write a program so your robot spells your initials. Construct Your Dreams!

Activity 5 - Racing mbot Computer Science Unit Build: Standard mbot (you can remove the ultrasonic sensor and the line follower) Program: If you upload to the board, you must use the remote control to control the robot. If you run the program from the mblock environment, you can use the remote control or the keyboard to control the robot. I used a simple program and ran it from the mblock environment: Play: Design a course for your robot to race on, and get racing. Challenge: Can you amend the code so that the robot is easier to handle? Activity 6 - Singing and Dancing mbot The options are endless with this robot. Write any song you like or make your own song, and then get the mbot grooving to the beat. Write some code that plays a song. Write some code that gets the mbot dancing. Run the program from the mblock environment. Put a When Green Flag clicked header on top of each block: Then when you click the Green Flag, both bits of code will run at the same time. This is how my mbot dances to music with the program I wrote: You can download my program and then have a go at writing your own. Construct Your Dreams!

Computer Science Unit