Professional Documents
Culture Documents
GOTO - Beacon: Programming Concepts Part C
GOTO - Beacon: Programming Concepts Part C
Part C
GOTO_Beacon
ENGR 10
Introduction to Engineering
1
Download the GOTO BEACON
program from the E10 website,
Robot lab section,
New controller
(Cortex)
2
Main() for GOTO_Beacon Program
Global
Variables
Infinite loop
3
4
The main body of the GOTO_Beacon program
is an infinite loop with three functions in the loop
PD7 PD0
Left side Right side
5
Read_PD()
find_max()
6
move()
7
Read_PD() Function
8
Find maximum intensity
9
find_max() Function
10
Move the robot
11
Move() Program
PD_sum<200, no
beacon in sight,
robot spins
PD_sum >5000,
robot slows down,
beacon is close
PD_sum >6000,
very close to
beacon, robot stops
Robot moves
toward beacon
12
limit_pwm() Program
13
Cortex Controller
PD2 reads max intensity max_no = 2
error = 4-2=2
steer=error*steer_sensitivity=2*20=40
14
How to add to the GOTO_beacon
program to perform the required task?
Read PD();
While Find red
Find Max();
state==1 beacon
Move ();
While Go to green
state==3 When found, state
=4
Find green
15
beacon
While Capture green (turn
off) ,
state==4 When confirmed.
state =5
While GO home,
state==7 When confirmed.
state =6
STOP
16
E10 robot, bumper switch
es, it wonders
Hsu/Youssefi 17
IR Receiver Board
Infrared
selector detectors
VEX
Controller 0
1
Intensity output
Exposure Tuning 2
AD1 amplifier 3
Control circuit 4
Frequency select sensitivity 5
AD14 6
7
counter
Exposure control 8
AD15 count 4
Reset to detector #0 2
AD16 reset 1
Circuit board
Board edge
Longer lead
18
Beacon Frequency Selection
(filter)
Tuning circuit
amplifier
1kHz
To next
stage
From
previous
stage
AD14
Freq select (0=1kHz, 1=10kHz)
19
IR Detector Selection
Infrared
Detectors 1kHz
LEDs Selector
counter
To
next
stage
1
0
1
AD16 AD15
Counter pulse
reset 1 Increment count (0 to 1
transition)
1 Count output set to zero
0 Get ready to count
20
Beacon Frequency Selection
(filter)
Tuning circuit
amplifier
1kHz
To next
stage
From
previous
stage
AD14
Freq select (0=1kHz, 1=10kHz)
21
Exposure Control Circuit
From
previous Amplifier
stage
AD15
To AD1
(VEX
1 Clear ‘film’ (discharge C14) Analog
input)
0 Open ‘shutter’ (allow C14 to charge)
22