Programming Scratch to Control a K NEX Fairground Ride

Similar documents
Scratch Lesson 2: Movies Made From Scratch Lesson Framework

EQ-ROBO Programming : Ladybird Robot

Teacher Cheat Sheet - Game Coding Challenges

Theo. Miles. Olivia. Joseph. Nina. Kishan. The Richard Pate School, Cheltenham

Lesson 10 Using and Sorting Lists

Techgirlz Workshop Scratch and Raspberry Pi

Controlling the Robotic Arm using the BBC micro:bit

Pibrella & Python. What is it? Table of Contents

Crossley Fields - Computing Vocabulary

SCRATCH. Introduction to creative computing with Scratch 2.0

Robolab. Table of Contents. St. Mary s School, Panama. Robotics. Ch. 5: Robolab, by: Ernesto E. Angulo J.

Making a maze with Scratch

Scratch Programming for Primary School Teachers Quiz Game

Lost in Space. Introduction. Step 1: Animating a spaceship. Activity Checklist. You are going to learn how to program your own animation!

Lost in Space. Introduction. Scratch. You are going to learn how to program your own animation! Activity Checklist.

Pointers, Arrays and Parameters

GALACTIC MOON 2CE. user manual. Abstract Design to Light 1996 Tel:

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator

SPRITES Moving Two At the Same Using Game State

Studuino Programming Environment Manual

Animate a Name Cards

Software is a computer that tells the computer how to perform particular.

Arduino Lesson 15. DC Motor Reversing

Review Response Submission Form for Continuing Review Form

We ll be making starter projects for many of the examples, to get people started. Those should be appearing at

Leica 3D Disto PROJECTOR in stair case

INTRODUCING THE CODEBIT!

ZeroView. Raspberry Pi Camera Module Suction Mount User Guide and Information. Product Page: ThePiHut.com/zeroview

Add in a new balloon sprite, and a suitable stage backdrop.

Acknowledgments...xvi Introduction... xvii Primer Project 1: Blinking an LED Project 2: Pushbutton LED Flashlight...

HyperBlade Wireless Saber Sound Software Scimitar Operating Instructions w/ Bluetooth Sound Modules Hyperdyne Labs 2006

ONE HOUR ANIMATION. Will you be a Scratcher upon completion of this session? Definitely. Learn how to write a basic script to animate a sprite.

ACTION ELECTRONICS. P110 Operating Instructions

Hi-Res 8 Wi-Fi Digital Picture Frame with MP3 player Table of Contents

MyNIC Team Site - Document Sharing

Animation Part 2: Using Windows Movie Maker for Voiceovers and More Duncan Whitehurst ICT Advisory Teacher Pembrokeshire County Council

Experimental Procedure. Frequently Asked Questions (FAQ) Kit General Questions. Setting Up and Using Your Raspberry Pi Projects Kit

-You will need to provide 2 AA batteries and an SD card to use the recorder.

A Beginners Guide to Raspberry Pi

Data Processing Software for Zeeman Effect Apparatus 1 INTRODUCTION

Scratch. Creative Computing

Transfer Software Activation to a New PC

Review Response Submission Form

Micro:bit - an Educational & Creative Tool for Kids

ENGR 1000, Introduction to Engineering Design

Quick Guide. Choose It Maker 2. Overview/Introduction. ChooseIt!Maker2 is a motivating program at first because of the visual and musical

micro:bit game controller with Scratch

This page outlines some of the alternate pieces that can be used for building.

SAM Animation: Troubleshooting

Make a game in which you play the notes of a song as they scroll down the stage.

Raspberry Pi Setup Tutorial

Key Stage 2 Scratch, Python and Kodu (Beginners)

1st ESO: Technology, Programming and Robotics. Unit 5: Programming. Autor: Guillermo Gómez

PowerPoint Timings, Transitions, Animation, & Sound

Lineup. Introduction. What you will need. Import your costumes. What you will make. What you will learn. Hardware. Software

9 Output Devices: Buzzers

code-it.co.uk Exploring Regular 2D Shapes & Patterns using sequence, repetition, nested loops, Program Aim: Program regular 2D shapes

Robotics and Electronics Unit 5

TOC F1 Operations Manual

USB Audio Cards with a Raspberry Pi

FIRESTORM AP1 AUDIO PLAYER USER GUIDE

Anjuli Kannan. Google Earth Driving Simulators (3:00-7:00)

Asset List & Content Creation

X3M. ExcelValley. MIDI + USB Sound Module: Supports hardware wavetable synthesis + audio. playback, multifunctional MIDI DIN connector.

Easy Start SpringBoard Lite

Itty Bitty City Code Companion IDE Arduino

Quick Reference Tables

Textbook. Topic 8: Files and Exceptions. Files. Types of Files

ICS 61 Game Systems and Design Introduction to Scratch

Introduction to Scratch

These instructions will help guide you through uploading the BMW Safari GPS routes file to your GPS device.

1. The PowerPoint Window

SECTION 2 (Part B) Types And Components Of Computer Systems. Sophia Pratzioti

Summer 2012 Animation

Scratch Lesson 11: Mini Mario Game Part II - Sprites

Not For Sale. Glossary

Programmable Control. Name Class Teacher. Ellon Academy Technical Faculty

4/28/2014. Defining A Replacement Cycle for Your Association. Introductions. Introductions. April Executive Director, Idealware. Idealware.

Data Backup Revised 11/07/2018

SCRATCH MODULE 3: NUMBER CONVERSIONS

Using PowerPoint to Create an Interactive Multimedia Portfolio Ben Johnson

Minimizer Kiosk Instructions Pi 3 Model

Leica 3D Disto PROJECTOR function for stair case applications

Open Packaging and find:

POWERSTATION 2015 Installation and License Setup (Rev: 11/16/2016) (631)

PENfriend2 labelling PEN

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

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Day #1. Determining an exponential function from a table Ex #1: Write an exponential function to model the given data.

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

1. What is the name of the control unit in Robotics? a. R2D2 b. MSN c. Pilot d. XJ7 e. RCX

Getting Started Manual for CODIBOT

imovie for ipad CREATING A PROJECT

Element Controller ,-- Installation and set-up Installer manual

AUDIO AMPLIFIER PROJECT

25Live Custom Report Integration

Microsoft PowerPoint and Digital Photos

OrbBasic LESSON 1 Goto and Variables Student Guide

DMD Extender. Application Note 1 Sega Large Screen LCD Replacement. V0.1 October 2013 Copyright 2013 Dr Pinball

Transcription:

Programming Scratch to Control a K NEX Fairground Ride

Raspberry Pi and K NEX System K NEX Model PiFace Motor Raspberry Pi Speaker LED Lights Switch

Computer Control Parts Scratch Raspberry Pi PiFace

How does Scratch control the motor, lights and mini speakers? Scratch Scratch Handler Raspberry Pi PiFace Switch Lights Motor Speakers KNEX Model Key = Software = Hardware

How does Scratch use the switch to control the lights and motor? Scratch Scratch Handler Raspberry Pi 1. Press the switch. Scratch gets to know by a certain variable being set to 1 PiFace 2. The Scratch program decides what to do and sets variables to tell the lights and motor what to do Switch Lights Motor Speakers KNEX Model

Example Code

PiFace When piface-output-3 is set to 1 These turn on If an LED light is connected, it turns on

Computer Models and Computer Simulation Forecasting (Computer Model: sky conditions above the UK) Computer Aided Design (Computer Model: printed circuit board) Computer Model = Computer s internal way of representing the real world objects Computer Simulation = Running a program that uses the computer model to predict how the real work objects will behave

Computer Models and Computer Simulation Why do we create computer models and run simulations? Because it s too difficult, too slow or too expensive to use the real thing To predict what will happen in the future, or predict how something will behave

Modelling and Simulating the System using Scratch The Scratch file Fairground Ride.sb file contains a model of the switch, lights and motor When you set certain variables, the model will simulate the real switch, lights and motor.

Switch 1 2 1 2 3 1 1 Press and release once Press and release second time Press and release third time 1 Press and release fourth time Code you put here runs when you press the switch the first time Code here runs on 2 nd press 3 Code here runs on 3 rd press Each time you press the switch it runs the next bit of code, then goes back to the start

LED Lights Turn on red light 1 Turn on red light 2 Turn on yellow light 1 Turn on yellow light 2 Turn on green light 1 Turn on green light 2 Turn off red light 1 If you wait between the set commands, the program will be less likely to hang. If you do too many things at the same time, the PiFace can t supply the electric current and it stops the Raspberry Pi. You will then have to reboot it.

Motor Set one of the variables to 1 and the other one to 0 to make the motor run Swap the numbers over to make the motor run in the opposite direction Set both the variables to 0 to turn the motor off. (Setting them both to 1 also turns the motor off). Don t forget to wait between the two set commands

Sound You can use the sound commands to play music or make other sounds on the mini speakers. The Raspberry Pi is not very good at sound processing, so the sound you get will be slightly distorted.

Stopping a Loop If you use a forever loop, it will never finish, even if you press the switch again. It will only stop when you press the red stop button at the top right in Scratch. If you want the loop to finish when the switch is next pushed, you need to create a variable (e.g. stop ) and use that to control the loop. Experienced programmers are all expected to use repeat-until loops in their programs

Open the Start Scratch File Run up Scratch and open Fairground Ride.sb from the Pupils Share. The Pupils Share can be found by clicking on the arrow to the right of Scratch Project, and then selecting drive I:

Writing the Scratch Program The Scratch file is already set up to connect to the PiFace. Click OK. Click on the Model sprite Put you own code under the three when I receive blocks All your code should go into one sprite. If you are interested, you can look at the other three sprites, but don t change them.

Simulating the System Simulate your program by pressing s. This does the same as pressing the switch in the real system. The button on the switch on screen will look as though it has been pressed, and the number will change. The lights on the screen will come on and off just as the real ones will. The motor will animate to turn one way or the other when the variables are set up to turn it on. Sound will come out of the computer speaker. When you use the mini speaker on the Raspberry Pi, the sound will be a slightly distorted version of this.

Saving the Program Use File / Save As to save the program onto a memory stick. Save the file to drive E: which is where the USB memory stick is. Put your names into the filename, so we can see which group wrote each program later. You will use the memory stick later to copy the program onto the Raspberry Pi.