Gadget Renesas

Linking Ideas and Electronics

Item

GR-ADZUKI Special Project

Have fun with Scratch (S4A)!

Overview

This article introduces a little bit of fun using GR-ADZUKI with Scratch, a visual-based programming tool for kids, which can be used with either Windows or Mac.
This sample uses the Scratch derivative solver calculator “S4A”.

login

Preparation

You will need a GR-ADZUKI board and a USB cable (micro B type).

login login

 

Protocol

1. Download and install S4A

Open the S4A site and click on “Downloads.”

login


Download and install S4A on the PC you will be using to create your sketch.

login



2. Set GR-ADZUKI switches and connect PC

Set the slide switch on GR-ADZUKI to “Scratch” as shown in the photo.

login



3. Startup S4A

Connect GR-ADZUKI to your computer and startup S4A. As soon as S4A is running, it will start looking for GR-ADZUKI and the message “Searching board...” will appear, as in the photo.

login


When it finds GR-ADZUKI, Analog0~Analog5, Digital2, and Digital3 will appear on the screen, as seen in the photo.
If this graphic is not displayed, please confirm the following:
・Is the GR-ADZUKI slide switch correctly set to Sketch?
・When using Windows, is the COM port set to number 32 or lower?
(If it is set to number 33 or higher, you need to use the device manager to set it to number 32 or lower.)

login



5. Confirm illuminance sensor (brightness) operations

Place your hand over GR-ADZUKI as shown in the photo to make it dark.

login


As you can see, the larger the value, the brighter the light and, conversely, the lower the value the darker, or less illumination.

login


5. Confirm button switch operations

GR-ADZUKI is equipped with 2 button switches. Try pressing the switch indicated by the finger in the photo.

login


Digital2 changes from false to true. Press the other button switch to see how Digital3 changes.

login


 

Flash LED

Let's experience scratch programming. Try flashing LED on GR-ADZUKI. Click "digital 13 on" block to the left as in the photo.

login


LED 13 flashes as following.

login


Arrange blocks as followings and then click "forever" to run. LED blinks as you can see.

login

When it gets dark, LED flashes

Then, let's try using a conditional statement to do XX when OO ocurs, and let the LED flashs when it gets dark. Arrage blocks as seen in the photo.

login


When holding hands and darkening, LED 13 flashes.

login

Have fun to change a costume

Let's make PC screen a little more fun at the end. Let's edit the costume. Open the Costume tab and click the Edit button as shown in the screen below.

login


Once you delete the costume. Press erase button.

login


Press import button.

login


Selecting a dog here. Press OK button. By the way, I selected this sprite because I wanted to walk the dog after this.

login


Making another costume. Press copy button.

login


Since the costume is duplicated, press the edit button to load another sprite.

login


Open the Script tab and add three blocks to the LED Flash sample as shown below. The costume changes only when you hold your hand, and the sprite will move. It seems like walking when you choose a dog.

login

login


Sample

As Scratch programming is quite simple, I won’t go into a detailed explanation here. But I would like to offer one simple sample.
Using the brightness sensor, this sample creates a fire-breathing dragon when a hand is held over the GR-ADZUKI board. To view the sample, download the following file and read it using S4A, then press the green flag.

Click the following link to start downloading the file.

dragon.sb

The following is a screen image.

login

Restoring S4A firmware

After overwriting GR-ADZUKI firmware with an Arduino sketch, you will need to restore the firmware to use S4A again. To do so, store the following bin file in GR-ADZUKI. For instructions on how to write the file to GR-ADZUKI, refer to 3. Sketch with compiler.

Click the following link to start downloading the file, and decompress the file after the download is complete.

adzuki_sketch_s4a.zip



share