10
PROTOTYPE SUMMER SCHOOL How to make an interactive light display You will need computer or Raspberry Pi with s4A ‘Scratch 4 Arduino’ installed. An Arduino with the S4A firmware uploaded.

Prototype Summer School: How to make an interactive light display

Embed Size (px)

Citation preview

Page 1: Prototype Summer School: How to make an interactive light display

PROTOTYPE SUMMER SCHOOL

How to make an interactive light display

You will need

computer or Raspberry Pi with s4A ‘Scratch 4 Arduino’ installed.

An Arduino with the S4A firmware uploaded.

Page 2: Prototype Summer School: How to make an interactive light display

How to control more than one light using the keyboard

Breadboards can be used to connect wires, lights, sensors and motors together.

Columns go up and down and are numbered 1 – 30, with letters a to j. If you connect two wires into the same numbered column they will be connected.

Rows going sideways are used for either (+) positive or (-) negative.

If you place two wires in the same (+) or (-) row they will be connected.

Page 3: Prototype Summer School: How to make an interactive light display

Light Show schematic

Place your Breadboard as shown in the picture so that the numbers on

the bottom half go from 1 on the left to 30 on the right.

Connect a black jumper lead from the GND pin nearest the Arduino

logo, to the 1st hole on the negative sideways row at the bottom of the

board. It is the furthest hole to the left, but 1 hole up.

Connect a red jumper lead from digital pin 10 on the Arduino to hole 5A

on the breadboard. This is the bottom hole in column number 5.

Connect another black jumper lead from hole 5A to any hole on the

negative sideways row at the bottom of the breadboard.

Page 4: Prototype Summer School: How to make an interactive light display

Resistors

Sometimes too much electricity can make an LED bulb blow up.

We don’t want this to happen so we’ll use a resistor to limit the electrical

current passing through our circuit.

Page 5: Prototype Summer School: How to make an interactive light display

A resistor has two wires. Place the resistor

wires in hole 9B and hole 9C.

It does not matter which resistor pin

goes in which hole.

LEDs

An LED is a light with two wires.

One is positive and one is negative. The positive wire is

longer than the negative one.

Stand the LED up on the table to test which is which.

Page 6: Prototype Summer School: How to make an interactive light display

Put the long leg of your 1st LED into hole 5A.

Put the short leg of your 1st LED into hole 4A.

Page 7: Prototype Summer School: How to make an interactive light display

Repeat this for more LED lights and connect them to Arduino pins 11,

12 or 13.

How to program light shows using the keyboard

Page 8: Prototype Summer School: How to make an interactive light display

From the Control drawer, drag out a When Green Flag Clicked block,

a Forever block and an If Else block. Connect them together like

shown.

From Sensing, drag out a Key Pressed block and place it in the top

socket of the If Else block.

From Motion, drag out a Digital On block and a Digital Off block and

place them as shown.

TEST: Click the green flag. What happens when

you press number 1 on the keyboard?

Debug: Check if the digital pin that you are turning on

and off with your Scratch code is the same number as

the Arduino digital pin that is connected to the long leg

of your LED.

Page 9: Prototype Summer School: How to make an interactive light display

Right click on the If Else block and

select duplicate. Place the new If Else

block below the 1st one.

For each new If Else block, edit the

key pressed and the digital pin turned on

or off so that you can trigger each of the

lights you have connected to the Arduino

by pressing a different key.

How to program automatic light

shows

Page 10: Prototype Summer School: How to make an interactive light display

You can make light so come on and off at different times by using a Wait

block. A wait block will ask Scratch4Arduino to wait for as long as many

seconds as you tell it to until it carries out the next instruction.

TEST: Click the green flag. What happens when you press ‘a’?

CHALLENGE: Create an interactive light show that allows the

user to select between 2 different light sequences. Try and

create one sequence that describes a positive emotion, like

happy, excited, or interested and one light sequence that

describes a negative emotions like sad, angry or bored.