schratching forkids.htm

About us  Contact  post comment    TEB Computer Academy

TEB   Computer   Kids  Academy

               Scratch Edition for young Learners         

Download/Scan TEB APP/Barcode - free download





schratching forkids.htm

Scratch PictoBlox - Arduino with Scratch




Program Arduino with Scratch

This post is about how to program the Arduino via Scratch.
The big difference between Scratch and C ++ is that in Scratch
you have so-called blocks and you hang them one after
the other instead of writing code.

The installation of Scratch for the Arduino
To program the Arduino with blocks,
there is an adapted scratch version
called Scratch for Arduino (S4A).
This program can be downloaded from the official website.
Installation is also quick, as you only have to specify a storage
location and choose whether you want to create a desktop icon.

Since Scratch, similar to NodeJS,
always sends the commands live to the Arduino,
there must be a sketch on the Arduino
that executes the commands received.
After you have uploaded it with the Arduino IDE,
the preparation is complete.

Create programs for the Arduino with Scratch
When you start Scratch, Scratch is looking for your Arduino.
As soon as it has been found, the current sensor values ​​
are continuously displayed.
For example the analog inputs or some digital pins.
This makes programming easier because you can check
how your Arduino reacts to something and what
it is currently measuring.
To do this, however, the Arduino must remain connected to your PC
the entire time and with Scratch for the Arduino it is also not possible
to permanently save a program on the Arduino

If we want to write a blink program, the LED on pin 13 must first be on,
wait a second, and the LED on pin 13 must be switched off again.
After waiting another second, the whole process should be repeated.

Switching the LED on and off is in the Movement category.
The 1 second wait and the endless loop in the control category.
It is practical to see how the individual command blocks can be used.
If they have an indentation at the top, you can put something in front of them.
If they have a bulge at the bottom, you can assemble them into a row.
Since a scratch program does not have to be loaded onto the Arduino,
an area is automatically executed as soon as the respective condition is met.
The respective blocks are then framed in white.

Scratch is a great and easy way to graphically program the Arduino.
However, there are also some restrictions (always associated with a PC)
that were noticed negatively.