Keyestudio Ks0428 Manual page 162

Table of Contents

Advertisement

www.keyestudio.com
photoresistor module, motor driving, to build a light-following
robot!
Just need to use 2 photoresistor modules to detect the light
intensity at the both side of robot. Read the analog value to rotate
the 2 motors, thus drive the tank robot run.
The specific logic of light following robot is shown as the table
below:
Detection
(the
higher
brightness, the greater
the value is)
If
Status
If
Status
If
Status
If
Status
Left photocell module
the
Right photocell module
left_light>650 and right_light>650
Go forward(PWM set to 200)
left_light>650 and right_light≤650
Rotate to left(PWM set to 200)
left_light≤650 and right_light>650
Rotate to right(PWM set to 200)
left_light≤650 and right_light≤650
stop
left_light
right_light
162

Advertisement

Table of Contents
loading

Table of Contents