Arduino class-set in Year 6

Today I tried out a class-set of 15 Arduinos with LEDs with Win 7 laptops with a Year 6 class with past experience of Scratch.

First  issue was that I only managed to get 8 set-ups working before the start of the lesson!

This was due to driver issues – I thought I was OK as I’d used Arduinos in the past in the school but all machines wanted to install a new driver and only 4 of them decided that the ones it had already were suitable.

With all the others, I had to download the latest Arduino package and use the drivers in that.

After that, plain sailing using ScA (Arduino version of ScratchGPIO) to make some Red/Yellow/Green LEDs go on and off.

All groups had a full pedestrian crossing LED Sequence and Scratch cat walking across a Zebra crossing on the screen with quite a lot having cars going back and forth and one group had a baby doing cartwheels across the road!

Technically ScA throws an error if they save and then reload another script meaning it has to be killed and restarted but I’ll hopefully sort that out and get some input handling added to it so be can use switches as well.

As usual, forget to take pics – will try and do better next time.

🙂

Post Post

There may be as easy solution to the driver probelm!

http://forum.arduino.cc/index.php?topic=86603.msg1768273#msg1768273

Pin Trigger handling in ScratchGPIO

I was looking at some of William Bell’s RPiScratchIO scratch code and notice that he had the concept of receiving broadcasts on inputs pins changing state.

So I’ve started implementing this (in dev version)

Basic concept is that if an input changes state – it will send a broadcast message to Scratch.

So if Scratch has a hat block that says

On Trigger received
Say “An input has changed state” for 2 seconds
Broadcast ResetTrigger

then if  any pin changes from 0 to 1 (or 1 to o) then Scratch will run the On Trigger block.

To make sure that only one event is dealt with at a time, my handler will not send any more changes until it receives a ResetTrigger from Scratch which is why that Broadcast ResetTrigger command is at the end.

As well as this global trigger, each pin has its own trigger so to just detect a change in pin7 use

On TriggerPin7 received
Say “Pin7 has changed state” for 2 seconds
Broadcast ResetTriggerPin7

If using an addon that names the inputs (say Switch) then the following would be triggered on a switch press

On TriggerSwitch received
Say “The switch has changed state” for 2 seconds
Broadcast ResetTriggerSwitch