Studuino Block Programming
Environment
Guide [Sensors and Push-button Switches]
This manual introduces the Studuino Software environment. As the Studuino
Programming Environment develops, these instructions may be edited or revised.
Index
1. Introduction ............................................................................................................ 1
1.1. Setup ........................................................................................................................ 1
1.2. Connecting Parts ..................................................................................................... 1
2. Using LEDs ............................................................................................................ 4
2.1. Connecting an LED to the Studuino Board ............................................................. 4
2.2. Port Settings............................................................................................................. 4
2.3. Creating a Program to Light up an LED .................................................................. 6
2.4. Making an LED Blink ................................................................................................ 8
2.5. Specifying the Number of LED Blinks .................................................................... 10
2.6. Changing the Blinking Speed ................................................................................ 13
3. Using Buzzers ...................................................................................................... 15
3.1. Connecting a Buzzer .............................................................................................. 15
3.2. Port Settings........................................................................................................... 15
3.3. Playing a Note ........................................................................................................ 16
3.4. Playing a Melody .................................................................................................... 18
3.5. Making a Melody Using a List ................................................................................ 21
3.5.1. Creating a List ................................................................................................. 21
4. Switches and Sensors .......................................................................................... 31
4.1. Push-button Switches ............................................................................................ 31
4.1.1. Port Settings ................................................................................................... 32
4.1.2. Checking a Push-button Switch ..................................................................... 32
4.1.3. Programming .................................................................................................. 35
4.2. Light Sensors ......................................................................................................... 42
4.2.1. Connecting a Light Sensor to the Studuino Board ......................................... 42
4.2.2. Port Settings ................................................................................................... 42
4.2.3. Checking the Light Sensor ............................................................................. 43
4.2.4. Programming .................................................................................................. 43
4.3. Reflective Infrared Sensors ................................................................................... 47
4.3.1. Connecting an Infrared Sensor to the Studuino Board .................................. 47
4.3.2. Port Settings ................................................................................................... 47
4.3.3. Checking the Reflective Infrared Sensor ........................................................ 48
4.3.4. Programming .................................................................................................. 49
4.4. Touch Sensors ....................................................................................................... 54
4.4.1. Connecting a Touch Sensor to the Studuino Board ....................................... 54
4.4.2. Port Settings ................................................................................................... 54
4.4.3. Checking the Touch Sensor ........................................................................... 55
4.4.4. Programming .................................................................................................. 56
4.5. Sound Sensors ...................................................................................................... 59
4.5.1. Connecting a Sound Sensor to the Studuino Board ...................................... 59
4.5.2. Port Settings ................................................................................................... 59
4.5.3. Checking the Sound Sensor ........................................................................... 60
4.5.4. Programming .................................................................................................. 60
1
1. Introduction
1.1. Setup
Before beginning, visit http://www.artec-kk.co.jp/en/studuino and download the
document Studuino Programming Environment Setup for reference.
1.2. Connecting Parts
① Connecting sensors, Buzzers, and LEDs
Sensor connecting cables are used to link sensors to the Studuino board. The
cables attach to Sensor/LED/Buzzer connectors located on the board, as shown below.
★ The three-wire cable is used for every sensor except the accelerometer, which requires a four-wire cable.
★ Sound, light, and reflective infrared sensors connect to A0 through A7.
★ Touch Sensors, LEDs, and Buzzers connect to A0 through A5.
★ Accelerometers connect to both A4 and A5.
★ Push-button switches A0-A3 cannot be used when using a sensor with connectors A0-A3.
Sensor/LED/Buzzer connectors
Gray wires face inside as shown.
A0 A1 A2 A3
A4 A5 A6 A7
2
② Connecting a DC Motor
Up to two DC motors can be connected using connectors M1 and M2.
★ DC motor cables can only fit into the connector one way.
★ DC motor connector M1 cannot be used at the same time as servomotor connectors D2 and D4.
★ DC motor connector M2 cannot be used at the same time as servomotor connectors D7 and D8.
③ Connecting a Servomotor
Up to eight servomotors can be connected to the servomotor connectors.
★ DC motor connector M1 cannot be used at the same time as servomotor connectors D2 and D4.
★ DC motor connector M2 cannot be used at the same time as servomotor connectors D7 and D8.
Gray wires face inside as shown.
D9 D10 D11 D12
D2 D4 D7 D8
M1
M2
3
④ Connecting a Battery Box
Connect the battery box cable to the POWER pins.
Sensors/LEDs/Buzzers/switches can use voltage supplied via USB, but DC motors
and servomotors require voltage from the power jack. When USB is disconnected,
all devices require voltage from the power jack to operate.
POWER
4
2. Using LEDs
This chapter explains how to program an LED. It covers connecting devices to the
Studuino board, setting ports, programming in the Block Programming Environment,
and transferring data to the board.
2.1. Connecting an LED to the Studuino Board
Connect an LED to Sensor/LED/Buzzer connector A4 on the Studuino board.
2.2. Port Settings
Before beginning to program, set the port information in the Block Programming
Environment to match your board. Select Edit from the menu then select Port Settings
from the pull down menu to open the setting dialog box.
① Click
② Click
The Port Settings dialog
box will appear
黒 灰
黒 A4 LED
Gray wires face inside as shown.
5
In the Port Settings dialog box, check A4 and choose LED.
You have now setup port information for your Studuino board in the Block
Programming Environment.
① Check the box here
② Click here
④ Click OK
③ Choose LED
6
2.3. Creating a Program to Light up an LED
Now we're going to use the block to learn the basics of
programming.
① Click Motion in the Command group palette then drag the block
from the Block palette to the block in the Script field. The blocks will
stick together.
★ Move blocks anywhere in the Script field by dragging and dropping them. If the block you're moving has any
blocks attached to them, they will be moved as a whole unit.
Make sure the blocks are attached properly!
Block palette
Script field
Command Group palette
① Click here
As shown, drag the
block until a white line
appears then drop it
② Drag and drop
7
② Connect the Studuino Board to a PC via the USB Cable. From the menu, select
Run then Transfer.
Seeing the pop-up below means that your program is transferring. The LED will
light up automatically once the transfer finishes.
Seeing the messages below means your program did not transfer successfully. Check
the solutions and try again.
Message Solution
Make sure the Studuino board is properly
connected to the PC via USB.
Unattached blocks present. Delete any
blocks that are not attached to the
block.
Close any applications that may be
communicating with your Studuino. If no
other applications are communicating with
the board, unplug the USB cable and press
the onboard Reset button.
① Click
②Click
8
2.4. Making an LED Blink
Use the LED program from the previous section and infinite repeat block
to learn about loops.
① Click Control in the Command group palette then drag a block from
the Control palette to the Script field. Attach it to the flashing LED program blocks.
② Right-click on to show the context menu then click Duplicate.
③ Attach the duplicated block under the block.
Attach the block to the
end of your program
① Right-click
② Select
The block will be
duplicated
① Click
As shown, drag the
block until a white line
appears then drop it
② Drag &drop
9
④ Drag from the Control palette to the Script field then drop it as the block
that will enclose the whole program.
⑤ Set the lower to OFF.
You have now made a program that will make your LED blink once every
second indefinitely.
Connect the Studuino board to the PC via USB. Choose Transfer from the Run
menu. After the data finishes transferring, the LED on the board will blink automatically
in one-second intervals.
① Turn on the LED
② Wait one second
③ Turn off the LED
④ Wait one second
Repeat indefinitely
① Click ▼
② Choose off
Make sure the block
encloses the whole
program
①Drag and drop
10
2.5. Specifying the Number of LED Blinks
Now we're going to learn how to control the number of times the LED blinks. Use
the blinking LED program from the previous section and to learn about
loops.
① Drag a block from the Control palette to the Script field.
② Move the blocks enclosed in to the opening of .
Drag &drop
Drop them
here
Drag &drop
11
③ Drag the block back to the Block palette.
Except the master block, all blocks in the Script field can be deleted by
moving them back to the Block palette.
★Right-click on a block to bring up the context menu and click Delete to delete it.
★Select Undelete from the menu bar to restore a block if you've accidentally deleted it.
④ Connect the group of blocks you made in step 2 to the block.
Now the program is finished. It will make an LED blink once every second, ten times
in a row.
Connect the Studuino board to the PC via USB. From the Run menu, choose
Transfer. After the data transfers, the LED on the board will automatically blink ten times
in one-second intervals.
Repeat ten times ① Turn on the LED
② Wait one second
③ Turn off the LED
④ Wait one second
Drag and drop
12
Next, we'll change the number of loops in the block to change the number of
blinks.
⑤ Click the number "10" on the block and change it to a different number.
The LED will blink that many times.
Connect the Studuino board to the PC via USB. From the Run menu, choose
Transfer. After the data transfers, the LED on the board will automatically blink in
one-second intervals.
Start a transferred program by clicking the Run menu and selecting Run.
★A transferred program can use battery power to run without a PC. Remove the USB cable from the
Studuino board. Connect the battery box and turn on its switch. The LED will blink the specified
number of times in one-second intervals.
★After the program finishes, restart it by pressing the Reset button on the board.
Battery box
Reset button
POWER
① Click here
② Click here
Click to input
13
2.6. Changing the Blinking Speed
Now we’ll control how fast the LED blinks by using the program from the previous
section as a base. We’re going to modify it by creating a program that uses variable
blocks.
① From the Command group palette, click Variables then Make a variable. A
name-setting dialog box will appear. Name your variable "time" and click OK.
② A block that controls time variables will be generated.
These are generated
automatically
① Click here
② Click here
③ Name it "time"
④ Click here
The Variable name
setting dialog box
will appear
14
③ Connect the block to the block and set the value to
0.5.
④ Connect the block to the block.
The program is complete. It will make an LED blink ten times in intervals of 0.5
seconds.
Connect the Studuino board to the PC via USB. From the Run menu, choose
Transfer. After the data transfers, the LED on the board will automatically blink ten times
in intervals of 0.5 seconds.
② Turn on the LED
③ Wait 0.5 seconds
④ Turn off the LED
⑤ Wait 0.5 seconds
Repeat ten times
① Set the time to 0.5
② Click here, then input
15
3. Using Buzzers
This section explains how to use a Buzzer in a program, including how to sound the
device, stop playing, and use the list and function blocks.
3.1. Connecting a Buzzer
Connect a Buzzer to Sensor/LED/Buzzer connector A5 on the Studuino board.
3.2. Port Settings
Set the port information in the Block Programming Environment so it matches the
board. Select Edit from the menu then select Port Settings from the pull down menu to
open the setting dialog box. In the Port Settings dialog box, check A5 and choose
Buzzer.
Check here and
choose Buzzer
黒 灰
黒
Gray wires face inside as shown.
A5 Buzzer
16
3.3. Playing a Note
Now we're going to make a program that makes the Buzzer sound for one second.
To control the sound, we'll use the block and the
block.
★ Select New under File in the menu to start a new program.
① From the Motion palette, choose and connect it to
.
② Click ▼ in the block to show the keyboard. Hovering over a
key with the mouse pointer will show its value. For now, click E (64).
① Click here
② Click here
Hover the pointer over a key to see its value
Drag and droop
17
③ From the Control palette, choose the block and connect it to the
block.
④ From the Motion palette, choose a block and connect it to the
block.
The program is complete. It will make the Buzzer will play an E note for one
second.
Connect the Studuino board to the PC via USB. Choose Transfer from the Run
menu. After the data finishes transferring, the Buzzer will play an E note for one second.
Drag and drop
Drag and drop
18
3.4. Playing a Melody
Create a program that plays C, C, G, G, A, A, C which is the melody for Twinkle,
Twinkle, Little Star. The Buzzer can play the song by outputting these notes one after
another.
① Add a block to the program you created in the previous section.
② Set the blocks to 0.3 and 0.1 seconds.
③ Right-click on the block to show the context menu then click
Duplicate. Attach the new duplicated blocks to your program.
① Right click
② Select Duplicate
Connect the duplicated
blocks to the originals
Drag and drop
19
④ Repeat step ③ to make 7 pairs of and blocks.
If you make too many, just drag the extra blocks back to the Command palette.
20
⑤ Set the blocks to C (60), C (60), G (66), G (66), A (67), A
(67), and G (66).
The program is complete. It makes the Buzzer play Twinkle, Twinkle, Little Star.
Connect the Studuino board to the PC via USB. Choose Transfer from the Run
menu. After the data finishes transferring, the Buzzer will play Twinkle, Twinkle, Little
Star.
21
3.5. Making a Melody Using a List
The program created in the previous section can be simplified by using a list. The
thing you’ll have to do is make a list.
3.5.1. Creating a List
① In the Variable palette, click on the Make a list button. Name the list "list_note".
② Two things will be created - an empty list and a group of blocks that control it.
These blocks
control the list
List
① Click here
② Click here
③ Name "list_note"
④ Click here
The Variable name setting
dialog box will
appear
22
Now we'll learn how each block controls a list.
③ Drag three blocks to the Script field and stick them together. Set
them to be 0, 12, and 15, as shown below.
④ Click and the blocks connected to will be executed in order. The
values 0, 12, and 15 will appear in the list.
The following steps will explain the processes of the list you made in step 4.
⑤ Next, delete the blocks created in step 3. After that, attach to
and input the numbers below to place 30 in the second row in the list.
Drag and drop
Click here These will be
executed
Values are added to
the empty list
Drag and drop
23
⑥ Click .
⑦ Next, delete . Drag to the Script
field. Attach it and set it to replace the value of row three in list_note with 6.
⑧ Click .
Click
The value in the third row
will be replaced with 6
Drag and drop
Click here
A new second row with a
value of 30 will be
inserted into the list
24
⑨ Next, delete . Drag to the Script field.
Attach it and set it to delete the value in the second row of list_note.
⑩ Click .
You can use the steps listed above to modify (add, insert, substitute, or delete)
values in a list. You can also access the information in the list with the following blocks.
Block Process
Gets the value of the specified row.
Gets the value of the specified row.
Check whether the list contains the specified value.
Next, we'll use a list to recreate the program from Playing a Melody.
Click here
The second row in the
list will be deleted
Drag and drop
25
● Playing a Melody using a List
The program created in 3.4. Playing a Melody runs seven times with different
pitches using combined blocks. We’ll simplify this program by using a list to set the pitch
of the block.
⑪ Delete and then delete all the list elements.
⑫ Drag seven blocks and stick them together as shown.
Drag and drop Make each element
active by clicking on it. Then click the x
that appears
26
⑬ Enter the values below into the blocks.
These values will be used for the pitch.
⑭ Drag from the Control palette and stick it to the top of the blocks
created in step 13. Click on the ▼ then choose "new..." and give the function the
name "init_code."
The completed "init_code" function will set the pitch of each note of "Twinkle,
Twinkle, Little Star." Blocks attached to will be executed when the
program runs. When is executed, each will run and the
numbers will be added to the list.
③ Name it "init_code."
④ Click
① Click
②
Select
27
⑮ Drag from the Control palette and connect it to . Click ▼
and choose init_code function.
⑯ Drag from the Motion palette and connect it to
.
⑰ Drag two from the Control palette and set them to 0.3 and 0.1.
Drag and drop
Drag and drop
Drag and drop Choose
“init_code”
28
29
⑱ Drag from the Variables palette and insert it into
as shown.
⑲ Click the Make a variable button in the Variables palette. Name the variable number.
⑳ Drag and place the newly-created variable block to the places shown below. Set to 1.
Drag and drop
① Click
② Type "number"
③ Click
The Variable name
setting dialog box
will appear
30
㉑ Connect a block from the Control palette and set it to 7.
The program you’ve just completed uses a list to play the beginning of Twinkle,
Twinkle, Little Star, performing the following actions.
The value of "number" increases by 1 every time a loop completes, using "number"
as a variable to play each sound registered to the list in order.
Connect your Studuino to the PC via USB and choose Transfer from the Run menu.
The Buzzer will play Twinkle, Twinkle, Little Star once the program transfers.
Repeat 7 times
Set variable "number" to 1
Run init_note function (registers sound data to the list)
Play the sound in row "number"
Wait 0.3 seconds
Set "number" to "number + 1"
Stop Buzzer
Wait 0.1 seconds
Drag and drop
31
4. Switches and Sensors
This section explains how to create programs that use sensors and push-button
switches. It also covers condition blocks and Test mode. This example program uses an
LED. Use connector A4 to connect the LED to the Studuino board.
4.1. Push-button Switches
The push-button switches are mounted on the Studuino board. Connector pins A0
to A3 are assigned to the switches.
A0
A1
A2
A3
黒 灰
黒 A4 LED
Gray wires face inside as shown.
32
4.1.1. Port Settings
Set the port information in the Block Programming Environment so it matches
the board. Select Edit from the menu then select Port Settings from the pull down menu
to open the setting dialog box.
In the Port Settings dialog box, make sure boxes A0 through A3 are checked.
For A4, select LED in the Sensor/LED/Buzzer area.
4.1.2. Checking a Push-button Switch
Check the push-button switch to make sure it works properly. Connect the
Studuino board to the PC via USB. Choose Test ON from the Run menu.
The Sensor Board
window will appear
① Click
② Click
Make sure these
boxes are checked
Make sure this box
is checked
33
Test mode will not start if the messages shown below appear. Try the solutions
below and try again.
Message Solution
Make sure the Studuino board is
properly connected to the PC via USB.
Close any applications that may be
communicating with your Studuino. If
no other applications are
communicating with the board, unplug
the USB cable and press the onboard
Reset button.
Pressing the Reset button on the Studuino board while in Test mode will cause
the connection between your Studuino and PC to be interrupted and the message
below to appear.
Message Solution
Though you can continue to
program once Test mode has
closed, the software will no longer
recognize your Studuino. We
recommend restarting the
software if you see this message.
34
The push-button switch sends a value of 1 in its normal state, and 0 when
pressed. Press push-button switches A0 through A3 and see if the corresponding
values change in the Sensor Board window.
If the values respond, the board is working properly. Now, exit Test mode by
selecting Test OFF from the Run menu.
While push-button switch A1 is
pressed, this value will be 0
35
4.1.3. Programming
Now we're going to create a program that makes an LED flash when a
push-button switch is pressed and learn how to create a program using .
① From the Control palette, drag to the Script field.
② Drag from the Control palette and attach it to the other blocks
③ Right-click and select Duplicate.
The blocks will be
duplicated
36
④ Change LED from On to Off in the duplicated block .
⑤ Connect the duplicated blocks to the originals.
⑥ From the Control palette, drag to the Script field. Fit the blocks from step
4 into the opening in .
37
⑦ Set the number of loops to 2.
⑧ From the Control palette, drag to the Script field.
⑨ From the Operators, drag and attach as shown.
38
⑩ From the Sensing palette, drag and attach to the left side of .
Next, set the right side to 0.
⑪ Move the blocks from step 6 into the opening of .
39
This group of blocks represents a program that makes the LED flash two times when
the push-button switch A0 is pressed (when the button's state is 0).
⑫ Drag to the Script field. Fit the blocks from step 10 into the opening in
.
⑬ Connect the group of blocks you made in step ⑪ to .
40
Now the program is finished. It will make an LED flash two times while
push-button switch A0 is pressed.
Connect the Studuino board to the PC via USB. Choose Transfer from the Run menu.
If the message below appears and goes away, it means the program was
successfully transferred to the board. After the data transfers, the LED on the board will
automatically flash two times when push-button switch A0 is pressed.
① Click here
② Click here
LED flashes two times while
the button is pressed
Repeat indefinitely
41
If the messages below appear, it means the program did not transfer
successfully. Check the solutions below and try again
Message Solution
Make sure the Studuino board is properly
connected to the PC via USB.
Delete any blocks that are not attached to
.
Close any applications that may be
communicating with your Studuino. If no
other applications are communicating with
the board, unplug the USB cable and press
the onboard Reset button.
42
4.2. Light Sensors
Light sensors are used to detect brightness.
4.2.1. Connecting a Light Sensor to the Studuino Board
Connect your light sensor to Sensor/LED/Buzzer connector A6.
4.2.2. Port Settings
Before beginning to program, set the port information in the Block Programming
Environment so it matches the board. Select Edit from the menu then select Port
Settings from the pull down menu to open the setting dialog box. In the Port Settings
dialog box, check A6 and choose Light Sensor. Check A4 and choose LED.
Check here and select
Light sensor
Check here and
select LED
黒 灰
黒
Gray wires face inside as shown.
Light sensor
A6
A4 LED
43
4.2.3. Checking the Light Sensor
Find the light sensor value. Connect your Studuino board to PC via USB cable.
Choose Test ON from the Run menu. In Test mode, the Sensor Board appears and
shows "[A6] Light Sensor."
The light sensor's brightness value ranges from 0-100, with 0 being the darkest.
Observe the value indicated on the sensor board while changing the brightness around
the light sensor. For example, shade the sensor and check the value.
If the values are responding, the sensor is working properly. Now, exit Test mode by
selecting Test OFF from the Run menu.
4.2.4. Programming
Now we'll use the light sensor to create a program that makes the LED flash in a
dark environment and learn to create a program that uses an block.
① From the Control palette, drag to the Script field.
The value changes according
to the brightness around the
light sensor
44
② From the Operators palette, drag and attach as shown.
③ Drag from the Sensing palette and attach it to the left side of .
Set 50 for the right side value.
The light sensor value responds to the brightness of the room. Set the value on the right by referring to
the value on the Sensor Board.
④ From the Motion palette, choose and move it to the opening of
. Set the lower block to OFF.
45
This group of blocks will make the LED flash in a dark area (sensor value under
50), and turn off when in a bright area (sensor value over 50).
⑤ Drag to the Script field. Fit the blocks from step 4 into the opening in
.
⑥ Attach the group of blocks from step 5 to .
46
Now the program is finished. It will make the LED flash in a dark area and turn
off in a bright one.
⑦ Check if the LED turns on or off depending on the brightness. Connect your
Studuino board to PC via USB cable. Choose Test ON from the Run menu.
⑧ When in the Test mode, click .
Do not disconnect the USB cable during Test mode.
Blocks being used by the program are shown with a white frame. Check if the LED
flashes by shading the light sensor with your hand to make it darker.
From the menu, select Run and then Transfer so that the program is transferred to
the Studuino board. It can now be run using battery power instead of a USB connection
to your PC.
The program will be run in
Test mode
Click
If it's dark
Turn on the LED
If it's bright
Turn off the LED
Repeat indefinitely
47
4.3. Reflective Infrared Sensors
A reflective infrared sensor calculates the distance of an object by emitting
infrared light and measuring the resulting reflection from the object.
4.3.1. Connecting an Infrared Sensor to the Studuino Board
Connect the reflective infrared sensor to Sensor/LED/Buzzer connector A7 on
your Studuino board.
4.3.2. Port Settings
Set the port information in the Block Programming Environment so it matches
the board. Click the Edit menu then select Port Settings from the pull down menu to
open the setting dialog box. In the Port Settings dialog box, check A7 and select
Reflective Infrared Sensor. Choose LED for port A4.
Select Reflective
Infrared Sensor
Select LED
黒 灰
黒
Gray wires face inside as shown.
A4 LED
A7 Reflective infrared sensor
48
4.3.3. Checking the Reflective Infrared Sensor
Now we're going to find the value of your reflective infrared sensor. Connect the
Studuino board to the PC via USB. From the Run menu, choose Transfer.
In Test mode, the Sensor Board appears and shows [A7] Infrared Reflection
Sensor. The sensor value represents the distance between the sensor and an object
using the number from 0 to 100. The number gets larger as the distance gets shorter
Move the object and check if the value indicated on the sensor board changes
corresponding to the changes in the distance between the sensor and the object.
If the values are responding, it is working properly. Now, exit Test mode by
selecting Test OFF from the Run menu.
The value changes in response to the
change in distance between the sensor
and an object
49
4.3.4. Programming
Now we'll use the reflective infrared light sensor to create a program that makes the
LED blink when an object comes near it and learn to create a program using the
block.
① From the Control palette, drag to the Script field.
② From the Control palette, drag to the Script field.
③ Right-click and select Duplicate.
Duplicated
② Select Duplicate
① Right-click
50
④ Set the duplicated to off.
⑤ Connect the duplicated blocks to the originals.
⑥ From the Control palette, drag to the Script field.
51
⑦ From the Operators, drag and attach it as shown.
⑧ Drag from the Sensing palette and attach it to the left side
of . Set 15 for the right side value. Move the blocks made in step 4 to the
opening of .
This group of blocks makes the LED flash when an object is near (sensor value
is greater than 12).
52
⑨ From the Motion palette, drag and attach to . Set
to the LED to OFF.
⑩ Attach the group of blocks made in step ⑦ to .
This program will make an LED blink when an object comes near.
Turn off the LED
If an object is near
The LED flashes once
Repeat indefinitely
53
⑪ Check if the program works by placing an object near the sensor. Connect your
Studuino board to PC via USB cable. Choose Test ON from the Run menu.
⑫ When in Test mode, click
Do not disconnect the USB cable during Test mode.
Move the object and check if the LED blinks when the value indicated on the
sensor board becomes greater than 15.
From the menu, select Run then Transfer so that the program is transferred to
the Studuino board and then it can be run using battery power instead of a USB
connection to your PC.
The program will be run in the Test mode
Click
54
4.4. Touch Sensors
A Touch Sensor detects if a button is pressed. It is used to judge things such as
object collisions.
4.4.1. Connecting a Touch Sensor to the Studuino Board
Connect a Touch Sensor to Sensor/LED/Buzzer connector A2 on the Studuino
board.
4.4.2. Port Settings
Set the port information in the Block Programming Environment to match your
board. Select Edit from the menu then select Port Settings from the pull down menu to
open the setting dialog box. In the Port Settings dialog box, uncheck A2 in the Button
area and check A2 in the Sensor/LED/Buzzer area and select Touch Sensor. Check A4
and select LED.
① Uncheck here
Select Touch Sensor Select LED
A4 LED
Touch Sensor A2
Gray wires face inside as shown.
55
4.4.3. Checking the Touch Sensor
Now we're going to check the value of the Touch Sensor. Connect the Studuino
board to your PC via USB cable. Choose Test ON from the Run menu. In Test mode,
the Sensor Board appears and shows "[A2] Touch Sensor."
The Touch Sensor sends a value of 1 in its normal state, and 0 when touched.
Press the Touch Sensor and check if values of the Sensor Board window respond.
If the values respond, the board is working properly. Now, exit Test mode by
selecting Test OFF from the Run menu.
Shows 0 when Touch Sensor is
pressed
56
4.4.4. Programming
Now we'll use the Touch Sensor to create a program that makes an LED flash
when the Touch Sensor is pressed and learn to create a program using .
① From the Motion palette, drag and attach to . Set to
the LED to OFF.
② From the Control palette, drag and attach to .
57
③ From the Operators, drag and attach as shown.
④ Drag from the Sensing palette and attach it to the left side of
. Set 0 for the right side value.
⑤ Drag from the Control palette and attach it to the other blocks.
58
Now the program is finished. It will make an LED flash two times when the
Touch Sensor is pressed.
Connect your Studuino board to PC via USB cable. Choose Transfer from the Run
menu. Check if the LED flashes when the Touch Sensor is pressed.
Turn off the LED
Wait until the button is pressed
Turn on the LED
59
4.5. Sound Sensors
Sound Sensors measure the loudness of a sound.
4.5.1. Connecting a Sound Sensor to the Studuino Board
Connect a Sound Sensor to Sensor/LED/Buzzer connector A3 on the Studuino
board.
4.5.2. Port Settings
Set the port information in the Block Programming Environment to match your
board. Select Edit from the menu then select Port Settings from the pull down menu to
open the setting dialog box. In the Port Settings dialog box, uncheck A3 in the Button
area and check A3 in the Sensor/LED/Buzzer area and select Touch Sensor. Check A4
and select LED.
① Uncheck here
Check here and select
Sound Sensor
Check here and
select LED
A4 LED
Gray wires face inside as shown.
A3
60
4.5.3. Checking the Sound Sensor
Now we're going to find the value of the Sound Sensor. Connect your Studuino
board to your PC via USB cable. Choose Test ON from the Run menu. In Test mode,
the Sensor Board appears and shows [A3] Sound Sensor.
The Sound Sensor value represents the volume of a sound using numbers from
0 to 50. Silence returns a value of 0, and increases as the sound becomes louder. Try
blowing on the Sound Sensor or making other sounds and to see if the values change in
the Sensor Board.
If the values respond, the board is working properly. Now, exit Test mode by
selecting Test OFF from the Run menu.
4.5.4. Programming
Now we're going to use the Sound Sensor to make a program that turns a
blinking LED off if you blow on the Sound Sensor using the block.
① From the Motion palette, drag to the Script field.
The values should change depending
on how loud a sound you make
61
② From the Control palette, drag and attach to the block in step 1.
③ Right-click and select Duplicate.
④ Connect the duplicated blocks to the originals.
The blocks will be
duplicated
① Right click
② Select Duplicate
62
⑤ Connect the duplicated blocks to the originals.
⑥ From the Control palette, drag to the Script field.
63
⑦ From the Operators palette, drag and attach as shown.
⑧ From the Sensing palette, drag and attach to the left side of
. Set 30 for the right side value.
⑨ Move the blocks made in step 4 to the opening in .
64
This program will make a blinking LED turn off if you blow on the Sound Sensor
(if the value becomes greater than 15).
⑩ Attach the blocks made in step 8 to .
⑪ From the Motion palette, drag and attach . Set to the LED to OFF.
65
Now we've made a program that will make a blinking LED turn off if you blow on
the Sound Sensor.
⑫ Check to see if the LED turns off if you blow on the Sound Sensor. Connect your
Studuino board to PC via USB cable. Choose Test ON from the Run menu.
⑬ When in the Test mode, click .
Do not disconnect the USB cable during Test mode.
Blow on the Sound Sensor and check if the LED turns off if the value of the
Sound Sensor becomes greater than 15.
From the menu, select Run then Transfer so that the program is transferred to
the Studuino board and then it can be run using battery power instead of a USB
connection to your PC.
The program will be run in
Test mode
Click
Loop until sound is heard
Blink LED
Turn LED off