loading
There are lots of people who are very comfortable with the Scratch programming environment but want to try something with Arduino to Blink Lights, Sense Buttons, Run Servos or whatever. They may find the C programming environment in Arduino IDE - Sketch, a bit too much of a step.

This instructable draws on the work of the guys at “Citilab” http://seaside.citilab.eu/scratch .

They have created a modified version of  Scratch to interface with Arduino.

Using Scratch Programs you can make Arduino Flash Lights, Read Buttons, and do many of the things that you can do with the the regular Arduino environment.

So if you like Scratch and Arduino but are not quite ready for C programming (yet), this is something you can try out.

Step 1: You Will Need

Follow the instructions on this linked page http://goo.gl/4pU2h to download and install :

1.  S4A ( Scratch 4 Arduino) and

2. the Firmware for Arduino to talk to S4A


For our experiment you will need:

* Arduino UNO
* Some LEDs
* A 560 Ohm resistor for each LED  (or a value similar to that)
* A 10k Ohm resistor
* A Pushbutton Switch
* Breadboard for wiring up e.g. (http://goo.gl/1E1iIl)
* Some Wires

Step 2: Flashing LED Experiment

To start we need to wire an LED and Switch to the Arduino (along with some Resistors), as shown in the diagrams below.

We're using the switch in the second experiment and the LED in both the first and second experiments.

Go ahead and wire it up as shown.

Step 3: Scratch Program 1: LED Blinking

Startup S4A (Scratch 4 Arduino) and Enter the Scratch program as Shown.

You Should Now See the LED flashing.

If you don't. Check the wiring.

The equivalent C program (Arduino Sketch) is shown below as well.

Compare the C and the Scratch and see if you can figure out what's going on.

Step 4: Scratch Program 2: LED and Button

Now we'll use the button to turn on on the LED when it's pressed.

Enter the Scratch shown.

Compare it to the equivalent C Code in the picture.

Try to Understand how they both work.

Step 5: One for You to Do

This is one for you to do yourself, based on the experiment above.

    Add another LED and Resistor as you did previously, but this time connect it to Arduino pin 12.

    Write a Scratch Program to Turn One LED ON and the other LED OFF when the switch is pressed. HINT: When the Switch is NOT Pressed the LED state should be opposite (i.e. ON:OFF become OFF:ON)

    Write a program to do the same thing in the Arduino IDE – C
<p>Where does the red &quot;Digital 3&quot; block come from in step 4?</p>
<p>not being able to connect S4A to an Arduino Uno on Win10. The connection on the Arduino on the Arduino does work.. Any suggestions on how to troubleshoot ? </p>
<p>Thanks for the help!</p>
<p>Informative Post!</p>
<p>exellent</p>
<p>Thanks for this instructable! Is there a way to see the code from within S4A?</p>
<p>Unfortunately, no because the Arduino doesn't run the S4A commands natively. But take a look at<a href="http://goo.gl/7tcOHH" rel="nofollow"> ArduBlock</a>. It's more flexible than S4A and does what I think you're looking for. Maybe I should write an Instructable for it....</p>
<p>I would LOVE an instructable for it :) I am trying to bridge between the drag and drop and written programming with middle school students. I tried ardublock once and didnt think I could paste code. </p>
<p>Click on the orange &quot;Ardublock&quot; link &quot; above and check out the instructions.</p><p>Ardublock generates the Sketch (C code) from the drag-and-drop code. I've used it successfully with kids aged 10+.</p><p>If you need more details I can write it up on Instructables.</p><p><img class="decoded" src="http://www.coderdojomidwest.com/wp-content/uploads/2013/06/ArduBlock.png"></p>
Great Instructable. <br>The Arduino / S4A combination is a great way to get non programmers to jump into both programming and interacting with the real world via the Arduino. <br>
Where Can I download S4A ???
excellent!

About This Instructable

59,023views

48favorites

License:

Bio: Technologist, Electronic Engineer, sometime Coderdojo mentor.
More by akellyirl:Arduino Guitar Tuner Using DSP Techniques Smart Home Thermostat Arduino Yun Messager 
Add instructable to: