LED - The Light Emitting Diode
Download Link : https://www.thymio.org/program/
There are two types of LEDs are used in Thymio, intensity can be adjusted by putting its values up to 32 points is maximum.
A. Visible Light LED (Red, Blue, Green)
B. Infra-Red LED (IR LED) – used as proximate sensory to calculating the distance between an object and Thymio Robot.
B. Infra-Red LED (IR LED) – used as proximate sensory to calculating the distance between an object and Thymio Robot.
# Note: “call” is used to call a function
A. Visible Light LED available in Thymio:
1. leds.bottom – RGB LEDs are available at the bottom of Thymio:
1.1 leds.bottom.left
Example: call leds.bottom.left(32,0,0)
1.2 leds.bottom.right
Example: call leds.bottom.right(0,0, 32)
2. leds.circle – available at the top Thymio in a circular form, its sequence is increasing (1 to 8) in a clockwise direction and it is of only one colour, but intensity can but changed.
Example: call leds.circle(4,8,12,16,20,24,28,32)
3. leds.top – It is RGB LEDs available at the top Thymio, and colour can be adjusted as per requirement.
Example: call leds.top(0,0,15)
4. led.buttons - only RED colour LEDs are available at every four buttons on the top of Thymio. LED’s light intensity can be adjusted.
Example: call leds.buttons(10,15,20,32)
5. The Visible light LEDs on each proximity sensors: Synonymously as LEDs available on each button on top of Thymio, visible-light LEDs indicators are associated with each proximate sensor which can be programmed as needed. It does not have any role in measuring the distance except indication only.
Syntax: leds.prox.h(led 1, led 2, led 3, led 4, led 5, led 6, led 7, led 8)
Whereas:
led1 – led6 belongs to front proximate sensors in a clockwise fashion,
led17 & led8 belongs to back proximate sensors in a clockwise fashion,
Example:
motor.left.target=200
motor.right.target=200
If : statement:
Example: call leds.bottom.left(32,0,0)
1.2 leds.bottom.right
Example: call leds.bottom.right(0,0, 32)
2. leds.circle – available at the top Thymio in a circular form, its sequence is increasing (1 to 8) in a clockwise direction and it is of only one colour, but intensity can but changed.
Example: call leds.circle(4,8,12,16,20,24,28,32)
3. leds.top – It is RGB LEDs available at the top Thymio, and colour can be adjusted as per requirement.
Example: call leds.top(0,0,15)
4. led.buttons - only RED colour LEDs are available at every four buttons on the top of Thymio. LED’s light intensity can be adjusted.
Example: call leds.buttons(10,15,20,32)
5. The Visible light LEDs on each proximity sensors: Synonymously as LEDs available on each button on top of Thymio, visible-light LEDs indicators are associated with each proximate sensor which can be programmed as needed. It does not have any role in measuring the distance except indication only.
Syntax: leds.prox.h(led 1, led 2, led 3, led 4, led 5, led 6, led 7, led 8)
Whereas:
led1 – led6 belongs to front proximate sensors in a clockwise fashion,
led17 & led8 belongs to back proximate sensors in a clockwise fashion,
Motors
These are used for locomotion purpose only
Example:
motor.left.target=200
motor.right.target=200
Conditional Statement
In Aseba we use a conditional statement to execute the certain task only upon a certain condition is trueIf : statement:
Syntax :
if condition then
Statement
end
Example:
(1). #
first initialise the button
onevent
buttons
if
button.left==1 then
motor.right.target=150
leds.bottom.left=(32,0,0)
end
(2). #
first initialise the button
onevent
buttons
if
button.right==1 then
motor.left.target=150
leds.bottom.right(32,0,0)
end
if - else : statement
Syntax:
if condition then
statements
elseif condition then
statements
end
Example:
# first initialise the button
onevent
buttons
if button.left==1 then
motor.right.target=150
motor.left.target=70
call
leds.bottom.left(32,0,0)
call
leds.bottom.right(0,0,0)
elseif button.right==1 then
motor.left.target=150
motor.right.target=70
call
leds.bottom.right(32,0,0)
call
leds.bottom.left(0,0,0)
end
Infra Red LED (IR LED) – An IR proximate
sensor is composed of IR transmitter to transmit the IR light and IR
receiver receive the reflected IR light, the amount of reflected IR light
depends on how objects are closed to the robot. If it receives large part
reflected (min -0 and maximum -1024) IR light, it means the object is closer.
These are the proximity sensors used to measure the
distance between Thymio robots and objects comes in the path
Total 9 proximity sensors
are available.
5 sensors – At Front panel is used to
measure the distance between forthcoming object and robots.
prox.horizontal[0] : left
prox.horizontal[1] : middle
left
prox.horizontal[2] : middle
– centre
prox.horizontal[3] :
middle-right
prox.horizontal[4] :
right
2 sensors – At the back panel of Thymio is
used to measure the distance of object at side of Thymio.
prox.horizontal[5] : left
prox.horizontal[6] : right
Example:
onevent
buttons
motor.left.target=500
motor.right.target=500
if prox.horizontal[0]==0 and
prox.horizontal[1]==0 and
prox.horizontal[2]==0 and prox.horizontal[3]==0 and prox.horizontal[4]==0 and prox.horizontal[5]==0 then
motor.left.target=500
motor.right.target=500
call
leds.top(0,32,0)
elseif prox.horizontal[0]>=1024 then
motor.left.target=500
motor.right.target=-50
call
leds.top(32,0,0)
elseif prox.horizontal[1]>=1024 then
motor.left.target=500
motor.right.target=-50
elseif prox.horizontal[2]>=1024 then
motor.left.target=-100
motor.right.target=500
elseif prox.horizontal[3]>=1024 then
call
leds.top(32,0,0)
motor.left.target=-100
motor.right.target=500
elseif prox.horizontal[5]>=1024 then
call
leds.top(32,0,0)
motor.left.target=-100
motor.right.target=500
end
2 sensors – At underneath sensors termed
as “ground.delta[0]” and “ground.delta[1]” to detect the surface on which robots
is moving.
0 Comments