If there is a hand or object in front of the left or right proximity sensor, it is judged as 'True', otherwise 'False'.
If the hand or object is too close (within 1cm), it will not be detected.
The sensor value of a Hamster robot
Parameter
- left proximity: The value of the left proximity sensor (0 to 255). Default: 0
- right proximity: The value of the right proximity sensor (0 to 255). Default: 0
The closer the object is, the greater the value of the left/right proximity sensor.
It detects obstacles at distances of 1 cm or more and 30 cm or less in front.
- left floor: The value of the left floor sensor (0 to 100). Default: 0
- right floor: The value of the right floor sensor (0 to 100). Default: 0
The range of output values of the left/right floor sensor is 0 to 255,
but since the brightest color (the brightest color among nearest white) is automatically adjusted to 100,
the range of sensor values used when writing codes is 0 to 100.
- acceleration x: The x-axis value of the acceleration sensor (-32768 to 32767). Default: 0
- acceleration y: The y-axis value of the acceleration sensor (-32768 to 32767). Default: 0
- acceleration z: The z-axis value of the acceleration sensor (-32768 to 32767). Default: 0
The acceleration sensor coordinate system of the Hamster robot is that the direction which the robot moves forward is the positive direction of the X-axis, the left direction of the robot is the positive direction of the Y-axis, and the upward direction is the positive direction of the Z-axis.
- light: The value of the light sensor (0 to 65535). Default: 0. The brighter, the greater the value.
- temperature: The temperature value inside the hamster robot (-40 to 88 degrees Celsius). Default: 0
- signal strength: The signal strength of Bluetooth wireless communication (-128 to 0 dBm). Default: 0.
As the signal strength increases, the value increases.
- input A: The value of the signal input from the external extension port A (analog input 0 to 255, digital input 0 or 1). Default: 0
- input B: The value of the signal input from the external extension port B (analog input 0 to 255, digital input 0 or 1). Default: 0
Turn left/right 90 degrees in place on the board composed of black grids.
The board can be downloaded from the
Tutorial - Classroom Materials - Worksheet.
Parameter
- left: Turn left 90 degrees in place.
- right: Turn right 90 degrees in place.
Move forward for the number of seconds entered.
Parameter
- Time to move (seconds, positive value)
Move backward for the number of seconds entered.
Parameter
- Time to move (seconds, positive value)
Turn left/right in place for the number of seconds entered.
First Parameter
- left: Turn left.
- right: Turn right.
Second Parameter
- Time to turn (seconds, positive value)
Add the values you entered to the current speed (%) of the left wheel and the right wheel respectively.
If the result is positive, the wheel rotates forward; if negative, the wheel rotates backward.
First Parameter
- The value to add to the current speed (%) of the left wheel
Second Parameter
- The value to add to the current speed (%) of the right wheel
Set the speed of the left wheel and the right wheel to the entered value (-100 to 100%), respectively.
If you enter a positive value, the wheel rotates forward.
If you enter a negative value, the wheel rotates backward.
Entering the number 0 stops it.
The value you entered is the % value based on the maximum speed.
First Parameter
- The speed of the left wheel (-100 to 100%)
Second Parameter
- The speed of the right wheel (-100 to 100%)
Add the value you entered to the current speed (%) of the left/right/both wheels.
If the result is positive, the wheel rotates forward; if negative, the wheel rotates backward.
First Parameter
- left: Add the value you entered to the current speed (%) of the left wheel.
- right: Add the value you entered to the current speed (%) of the right wheel.
- both: Add the value you entered to the current speed (%) of each of the left wheel and right wheel.
Second Parameter
- The value to add to the current speed (%) of the selected wheel
Set the speed of the left/right/both wheels to the entered value (-100 to 100%).
If you enter a positive value, the wheel rotates forward.
If you enter a negative value, the wheel rotates backward.
Entering the number 0 stops it.
The value you entered is the % value based on the maximum speed.
First Parameter
- left: Set the speed of the left wheel to the value you entered.
- right: Set the speed of the right wheel to the value you entered.
- both: Set the speed of both wheels to the value you entered.
Second Parameter
- The speed of the selected wheel (-100 to 100%)
Move along the black/white line by using the left/right/both floor sensors.
First Parameter
- black: Move along the black line on a white background.
- white: Move along the white line on a black background.
Second Parameter
- left: Move along the line by using the left floor sensor.
- right: Move along the line by using the right floor sensor.
- both: Move along the line by using the both floor sensors.
Move along the black/white line on the left/right/front/rear,
then stops when it encounters the intersection.
When you first start, it is best to choose the 'front' or 'rear' intersection for the second parameter.
The robot may not turn left or right if the first starting position is not exactly on the intersection.
If the robot encounters an intersection while moving, it will stop at the correct location,
so you can choose anything for the second parameter from hereafter.
First Parameter
- black: Move along the black line on a white background.
- white: Move along the white line on a black background.
Second Parameter
- left: After turning to the left, move along the line and stop when the robot encounters an intersection.
- right: After turning to the right, move along the line and stop when the robot encounters an intersection.
- front: Move forward along the line and stop when the robot encounters an intersection.
- rear: After turning 180 degrees, move along the line and stop when it encounters an intersection.
Set the speed (1 to 8) to move along the line.
The greater the number, the faster the movement.
Parameter
- The speed to move along the line (1 to 8)
Stop both wheels.
Turn on the left/right/both LEDs to the selected color.
First Parameter
- left: Turn on the left LED.
- right: Turn on the right LED.
- both: Turn on the both LEDs.
Second Parameter
- LED color (red, yellow, green, sky blue, blue, purple, white)
Turn off the left/right/both LEDs.
Parameter
- left: Turn off the left LED.
- right: Turn off the right LED.
- both: Turn off the both LEDs.
The buzzer sound of 440 Hz sounds short (0.2 seconds).
Add the value you entered to the current pitch (Hz) of the buzzer sound.
You can enter up to two decimal places.
Parameter
- The value to add to the current pitch (Hz) of the buzzer sound
Set the pitch of the buzzer sound to the value (Hz) you entered.
You can enter up to two decimal places.
Entering the number 0 turns off the buzzer sound.
Parameter
- The pitch of the buzzer sound (0 to 167772.15 Hz)
Turn off buzzer sound.
It sounds the note of the selected pitch and octave as much as the beat you entered.
First Parameter
- Pitch (C, C#, D, Eb, E, F, F#, G, G#, A, Bb, B)
Second Parameter
Third Parameter
Rest as much as the beat you entered.
Parameter
Add the value you entered to the current BPM (beats per minute) of playing or rest.
Parameter
- The value to add to the current BPM (beats per minute)
Set the speed of playing or rest to the BPM (beats per minute) you entered.
Parameter
- The speed of playing or rest (BPM, beats per minute)
Set the input/output mode of the external extension port.
First Parameter
- A: Set the input/output mode of port A among the external extension ports.
- B: Set the input/output mode of port B among the external extension ports.
- A and B: Set the input/output mode of both port A and port B.
Second Parameter
- analog input: Set the input/output mode to the analog input.
- digital input: Set the input/output mode to the digital input.
- servo output: Set the input/output mode to the analog servo output.
- pwm output: Set the input/output mode to the PWM output.
- digital output: Set the input/output mode to the digital output.
Add the value you entered to the current output value of the external extension port.
The result will have the following range depending on the mode of the external extension port.
- servo output: Valid values are 1 to 180 degrees. If 0, the output is always 0 without PWM pulse.
- pwm output: 0 to 255. Set the duty ratio of ON state in PWM waveform to 0 to 255 steps.
- digital output: LOW if 0, otherwise HIGH
First Parameter
- A: Add the value you entered to the current output value of port A among the external extension ports.
- B: Add the value you entered to the current output value of port B among the external extension ports.
- A and B: Add the value you entered to the current output value of each of port A and port B.
Second Parameter
- The value to add to the current output value of external extension port
Set the output value of the external extension port to the value you entered.
The input value has the following range depending on the mode of the external extension port.
- servo output: Valid values are 1 to 180 degrees. If 0, the output is always 0 without PWM pulse.
- pwm output: 0 to 255. Set the duty ratio of ON state in PWM waveform to 0 to 255 steps.
- digital output: LOW if 0, otherwise HIGH
First Parameter
- A: Set the output value of port A among the external extension ports to the value you entered.
- B: Set the output value of port B among the external extension ports to the value you entered.
- A and B: Set the output values of both port A and port B to the value you entered.
Second Parameter
- The output value of the external extension port
Contents
Copyright Robot Software Education Institute. All rights reserved.
Please contact prof. Kwang-Hyun Park (
akaii@kw.ac.kr) if you have any problem.