0% found this document useful (0 votes)
26 views

Exercises: Refer Datasheet For The List of Command/coding Function

The document provides exercises to program a robot using functions for LEDs, motors, encoders, and sensors, with the goal of navigating a course to accumulate points within a time limit by controlling motor speed and direction based on encoder values and switches. Critical thinking is required to build a program to autonomously navigate the course using the robot's components and earn the most points possible. Solutions should be tested and demonstrated to facilitators within 90 minutes.

Uploaded by

utp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Exercises: Refer Datasheet For The List of Command/coding Function

The document provides exercises to program a robot using functions for LEDs, motors, encoders, and sensors, with the goal of navigating a course to accumulate points within a time limit by controlling motor speed and direction based on encoder values and switches. Critical thinking is required to build a program to autonomously navigate the course using the robot's components and earn the most points possible. Solutions should be tested and demonstrated to facilitators within 90 minutes.

Uploaded by

utp
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Exercises

Refer datasheet for the list of command/coding


function
Exercise 1
• Take the source code from the exercise1.c
• (Switch 1) All LED on and off with delay 50000
followed by buzzer on off.
• (Switch 2) LED 1 and LED 2 will on
• (Switch 3) LED 7 and LED 8 will on

• Note, all the function need to be build not


more than 5 line.
Exercise 1
Some code might help………….
Led=0xff; (all led on)
Led=0x00; (all led off)
Buzzer=1 ( on buzzer)
Delay( amount of cycle)
led1,led2,led3,led4….led8
Exercise 2
• Rolling the LED left right
• (switch1) LED by bit moving to right
• (switch2) LED by bit moving to left

• While(1)
• If (!swf)
• {
Delay( 3000)
led1,led2,led3,led4,led5,led6,led7,led8
Exercise 3
• Define ccw and cw for the brushless motor.
• Build a function to brake and stop the motor.
- Brake, the motor will stop without inertia
- Stop, the motor will stop with inertia
• Build a function to insert speed value, the
function name should pwm1(int x) for
brushless 1 and pwm2(int x) for brushless 2
Exercise 3
• Create a function, rotate the motor that connected to
brushless 1 as ccw and motor that connected to
brushless 2 as cw, the motor need to move with given
condition for delay 300000.
• The speed of both motor are 150.
• When sw1 at main board is pressed, the above
function is called and it will brake when the function is
finished.
• When sw1 at control panel is pressed, the above
function is called and it will stop.
Exercise 3
• Lastly, please state the outcome of the robot if
motor that connected to brushless 1 are right
motor and brushless 2 are the left motor.

front

Left wheel Right wheel


Exercise 4
• Using the same configuration as in exercise 4 except for the
speed.
• When sw1 press for the first time the speed of the both
motor need to increase from 20 to 250 with 23 steps in
delay 50000 each steps and maintain with the maximum
speed.
• When the second time the sw1 press, the both motor need
to decelerate from 250 to 0, with 25 steps with delay 25000
each steps, and then brake.
• For both function, the value of the speed need to be
display at the control panel LCD.
Exercise 5
• Define for encoder and encoder clear for
brushless 1 and brushless 2.
• Build a function
– Clear the encoder.
– Start both motor, with left configuration, speed 50.
– If the encoder 5000, the motor break, the buzzer
will buzz and all LED will be blinking.
– The value of increasing of encoder need to be
display at the control panel LCD
Exercise 6
• Define for every digital input that been used.
• Create all possible function to perform this
task
• If the digital input 1 send 0 for the 1st time the
both motor start to rotate with speed 50 with
left configuration, the second time the digital
input 1 send 0 the both motor will rotate with
speed 100 in right configuration.
Exercise 6
• if sw1 is press, the motor will rotate with speed 255
in forward configuration for 100m, and then the
motor brake. (make sure the encoder been cleared
first.)
assuming 100 encoder = 1m.
• All this program starts when sw1 at the control panel
are pressed.
• display the speed of the motor and the encoder value
at the control panel while performing all it task.
Critical thinking problem
Pass through this box, will earn points that
• Your robot has Stated at the box.

– 2 brushless motor 500 encoder

10p 10p -10p


End Point 500 encoder
25p 4p 4p 2p
10p -40p

1p 1p 1p 3p 1p Obstacle
1p
Starting
point 1p -40p 20p -10p
PLEASE USE YOUR IMAGINATION
• The robot size is 250 encoder x 250 encoder
• The robot can start any where at the 4 box of the
starting point
• The game time is 3 minutes, when the motor
starts, the time starts.
• Gain as many point as you can, when you reach
the end point, your point are counted, if you
never arrive at the end point within this 3
minutes, you will earn 0.
Guide
• Use 24 volts, 2 brushless motor only.
• Use control panel, main board and the
brushless card.
• Assume encoder 50 will perform 90 degrees
turning.
• If finishing every task, your robot need to
brake automatically.
TASK
• BUILD A PROGRAM TO ENTER THE GAME.
• WHEN FINISH, CALL THE FACILITATOR TO
EVALUATE YOUR OUTPUT.
• USING CONTROL PANEL,WILL GET PLUS POINT.
• PLEASE DO THIS PROGRAM AND TEST RUN,
WITHIN 90 MINUTES.

You might also like