Explore and Challenge:

Similar documents
Explore and Challenge:

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

GrovePi Temp-Humidity Sensor Lesson Video Script. Slide 1

Objective of the lesson

Scratch for Beginners Workbook

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

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

A - Debris on the Track

A - Debris on the Track

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

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

In this project you ll learn how to create a platform game, in which you have to dodge the moving balls and reach the end of the level.

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

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.

Programming with Scratch

Brain Game. Introduction. Scratch

Lesson 2 Game Basics

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Introduction Installation Switch Skills 1 Windows Auto-run CDs My Computer Setup.exe Apple Macintosh Switch Skills 1

Arduino Lesson 1. Blink. Created by Simon Monk

In this project we ll make our own version of the highly popular mobile game Flappy Bird. This project requires Scratch 2.0.

Create a game in which you have to guide a parrot through scrolling pipes to score points.

Scratch LED Rainbow Matrix. Teacher Guide. Product Code: EL Scratch LED Rainbow Matrix - Teacher Guide

LEVEL A: SCOPE AND SEQUENCE

Your EdVenture into Robotics 10 Lesson plans

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

Before displaying an image, the game should wait for a random amount of time.

An Introduction to Programming using the NXT Robot:

Here Comes the Sun. The Challenge

Open the Tech Toys Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/toys-go.

Create a "Whac-a-Block" game in Minecraft

Introduction to Turtle Art

Introduction to programming with Fable

Fireworks. Level. Introduction: In this project, we ll create a fireworks display over a city. Activity Checklist Follow these INSTRUCTIONS one by one

Drawing Layouts Paper space & Model Space

Create a Simple Game in Scratch

FINAL REVIEW. Well done you are an MC Hacker. Welcome to Hacking Minecraft.

Pong! The oldest commercially available game in history

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

Pong Game. Intermediate. LPo v1

D - Robot break time - make a game!

Starting from LEARNER NOTES edited version. An Introduction to Computing Science by Jeremy Scott

Project Kit Project Guide

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Programming 2 Servos. Learn to connect and write code to control two servos.

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

The Games Factory 2 Step-by-step Tutorial

Step 1 : Earth and Mars Orbit the Sun

Module 4 Build a Game

Statistics Laboratory 7

Session 11 Introduction to Robotics and Programming mbot. >_ {Code4Loop}; Roochir Purani

Setting up Volumio to get great audio

Creating Computer Games

Create Your Own World

pla<orm-style game which you can later add your own levels, powers and characters to. Feel free to improve on my art

Clone Wars. Introduction. Scratch. In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

UWYO VR SETUP INSTRUCTIONS

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

Creating a Maze Game in Tynker

Overview. The Game Idea

Line-Follower Challenge

A - Debris on the Track

Programming PIC Microchips

Assessment. Self Assessment. Teacher Assessment. Date Learning Objective(s) Achievement or. NC Level: Game Control Student Booklet P a g e 1

UNIT TWO: Data for Simple Calculations. Enter and format a title Modify font style and size Enter column headings Move data Edit data

Project 1: Game of Bricks

How Do You Make a Program Wait?

Programming I (mblock)

SolidWorks Design & Technology

Programming. covers Scratch 2.0 and Scratch 1.4. Foreword by Mitchel Resnick MIT Media Lab PLAIN ENGLISH EASY TO FOLLOW FULLY ILLUSTRATED

The Discussion of this exercise covers the following points: Differential-pressure transmitter. Differential-pressure transmitter

The Revolve Feature and Assembly Modeling

How to Use the Gadget and Worksheets. Overview Week 3

CamJam EduKit Robotics Worksheet Six Distance Sensor camjam.me/edukit

Rock Band. Introduction. Scratch. In this project you ll learn how to code your own musical instruments! Activity Checklist.

Lab book. Exploring Robotics (CORC3303)

Flappy Parrot Level 2

- Introduction - Minecraft Pi Edition. - Introduction - What you will need. - Introduction - Running Minecraft

Build your character s back story

Pong! The oldest commercially available game in history

SOP: Polyvar Met Light Microscope

Robot Programming Manual

In this technical note, the use of the Build signal tool will be covered in more detail.

Granny Square Crochet For Beginners. US Version. Shelley Husband. Published by Shelley Husband at Smashwords. Copyright 2015 Shelley Husband

Unit 4: Robot Chassis Construction

FPGA SI Tutorial - Simulating the Reflection Characteristics

--YOUR GUIDE TO-- GOOGLE MY BUSINESS. ScreenRelevance.com

1 Best Practices Course Week 12 Part 2 copyright 2012 by Eric Bobrow. BEST PRACTICES COURSE WEEK 12 PART 2 Program Planning Areas and Lists of Spaces

The USB Brotherlink 4 - or Cartridge Cable

ADD A REALISTIC WATER REFLECTION

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

Apple Photos Quick Start Guide

Pi-Cars Factory Tool Kit

Excel TGI Football Game DELUXE Instructions & Help File

How To Change Eye Color In Photoshop

Excel 2003: Discos. 1. Open Excel. 2. Create Choose a new worksheet and save the file to your area calling it: Disco.xls

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

Bohunt School (Wokingham) Internet of Things (IoT) and Node-RED

Randomness Exercises

Transcription:

Explore and Challenge: The Pi-Stop Traffic Light Sequence SEE ALSO: Discover: The Pi-Stop: For more information about Pi-Stop and how to use it. Setup: Scratch GPIO: For instructions on how to setup Scratch GPIO with Pi-Stop (which is needed for this section). Explore and Challenge Scratch GPIO: Pi-Stop First Steps: If you've not used Scratch before, this will provide a quick introduction to building your first Scratch GPIO program. In this guide we make use of Scratch GPIO produce a standard traffic light sequence with the Pi-Stop. Getting Started The Pi-Stop should be connected to the Raspberry Pi in Location A, as follows: Location A for Model A+, B+ or Raspberry Pi 2 (purchased after July 2014)

Location A for Model A or B (purchased before July 2014) With the Pi-Stop fitted in the correct position you can now power up your Raspberry Pi. Run Scratch GPIO If you are still in the Raspberry Pi terminal, start the desktop environment using: startx Open Scratch GPIO from the desktop using the Scratch GPIO icon (we do not need the ScratchGPIO 7 Plus): Scratch GPIO 7 is the standard version, while Scratch GPIO 7 plus provides additional support for several add-on boards. NOTE: If you are using X-Forwarding, you can run Scratch GPIO with the following commands: sudo cp ~/.Xauthority ~root/ sudo /opt/scratchgpio7/./scratchgpio7.sh Get ready In this example we will use the following blocks, all of which are located in the control section: We will use one or more of the following: broadcast blocks wait blocks when I receive blocks forever block NOTE: For more information on the broadcast, wait and forever blocks see Explore and Challenge Scratch GPIO: Pi-Stop First Steps which introduced them for the first time.

Designing our traffic sequence Before we go any further we should take some time to work out what the correct sequence of lights a traffic light should show. This way we can design our program and then test to see if it behaves as we wanted. The STOP Sequence QUESTION: When a traffic light is GREEN (GO) and starts to change, what lights will be lit as it changes to STOP the traffic? WORKSHEET: On your worksheet colour in the correct traffic light sequence, starting with GREEN (as shown above) and ending with the light showing STOP. WORKSHEET: On the broadcast blocks fill in the required commands to switch on or off the appropriate LEDs (by switching on or off the pins), The GO Sequence QUESTION: When a traffic light is RED (STOP) and changes to GO, what is the normal sequence of lights? Again, fill in the required broadcast commands. WORKSHEET: On your worksheet colour in the correct traffic light sequence, starting with RED and ending with the light showing GO. WORKSHEET: Again, complete the required broadcast blocks to switch each of the lights on or off. Great work! You can now create each of the broadcast blocks in Scratch and click on them to test each step. Putting the blocks together We will now create a new broadcast group of blocks to recreate the required LED sequence.

The broadcast STOP Block Start the group with a when I receive block called STOP: Add our first light change: Add a wait block (so the lights do not change instantly): Add our second light change: Broadcast GO Block Simply do the same with the other light changes, but call this when I receive block GO: Excellent! Now you can test these blocks by clicking on them directly and see if we have our correct traffic light sequences! WORKSHEET: Tick the checkbox marked "I've created the Pi-Stop STOP and GO sequences" The Final Program - Changing Lights At the moment our program will not do anything unless we click on it. Just like we did in the previous guide (Explore and Challenge Scratch GPIO: Pi-Stop First Steps) we will use a forever block to repeat our sequence. We will also add a when green flag clicked block to kick off our sequence (allowing you to use the small flag in the top right to start, and the red circle to stop. For our traffic lights we want them to start by changing to GO (by broadcasting "GO") then wait for some time (for example 10 seconds) and then change to STOP (by broadcasting "STOP"). Putting the blocks together we end up with:

When you run the program (by clicking on the Green Flag) you will see each part is highlighted with a white outline while it runs through the forever loop and runs each of the broadcast group blocks GO and STOP. WORKSHEET: Tick the checkbox marked "I've created the Pi-Stop the full Traffic Light Sequence" Remember to save your completed work by selecting File and Save As... from the menu. Behold the Changing Lights! Try your own projects... Now you have your very own traffic light you can use in your own projects! Below are some ideas, or you can move onto the next guide: Explore and Challenge Scratch GPIO: Pi-Stop Reaction Game. Start a race IDEA: Fed up with unfair starts when starting a race? Why not start your races with your own starting lights! Use the Pi-Stop to start your Scalextric (TM) or Hot Wheels (TM) races, ensuring everyone gets a fair chance. QUESTION: Can you create a Formula 1 style starting lights (where each light lights up and they all go off, the race starts when the lights are off). QUESTION: Can you change the program to make the light change with a random wait time (making it harder to go before they change)? Hint: See the next guide (Explore and Challenge Scratch GPIO: Pi-Stop Reaction Game) which makes use of random delays. WORKSHEET: Tick the checkbox marked "Extended Task: Created a racing start light control" Control multiple Traffic Lights IDEA: Perhaps your LEGO City (TM) needs some traffic control. QUESTION: Can you extend the traffic light sequence to use a second Pi-Stop fitted in Location B so you can control traffic at a junction?

Location B for Model A+, B+ or Raspberry Pi 2 (purchased after July 2014) Location B for Model A or B (purchased before July 2014) If you want to try this, please ask for an extra Pi-Stop to use in your project. Hint: You will need to create new broadcast blocks using the 2nd set of pins. Also, think about giving drivers time to react before the other set of lights turns GREEN! WORKSHEET: Tick the checkbox marked "Extended Task: Controlled two Pi-Stops at the same time!" The next guide is: Explore and Challenge Scratch GPIO: Pi-Stop Reaction Game.