Laser Trike

stan74

Senior Member
It works ok. Line follower bots seem over complicated with several sensors. I've never built one but have a roll up track for one. Why can't it just sense difference between black and white,then move servo say left and if it's white then turn right, if it is black turn left?
 

stan74

Senior Member
Far out man.Neat algo, fnarrr! Is that the "challenge" when you invited me to make a line follower?
I like the small bot,nippy and small and the track doesn't take up much space. I can't find the cybot line sheet (that was nostalia :( )
I reckon it relies on inertia to go over gaps...cheating...no,I use that in my sonar bot when turning.
I just discovered I can use pwm with the servo command...read the small print- servo can't be used with pwm...unless later x2, snook in so you don't see it and the time I've spent trying pwm to control a servo.l8r
 

erco

Senior Member
Not much of an algorithm, just one IF and one ELSE. I'm a code crunching minimalist.

Code:
#picaxe 08m2

servo 0,150 ' steer servo 70=left 155=straight 230=right
servo 1,110 ' drive servo 110=forward 150=stop
'pin c.2 laser sensor , no lens  black=1    white=0

do
if pinc.2=0 then let b0=b0-2 min 70
else let b0=b0+2 max 230
endif
servopos 0,b0
pause 10
loop
 

erco

Senior Member
Here's the same laser sensor from my Picaxe Trike used in an optical scanning project. Spoiler: not Picaxe! Servo code would actually have been shorter & easier on an 08M2, but I used a Stamp because of its giant DEBUG display screen.

 
Top