Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: Light Senser (http://www.chiefdelphi.com/forums/showthread.php?t=74989)

Connor 19-02-2009 17:35

[FTC]: Light Senser
 
My code is trying to use the light senser to follow the white lines during autonomous. I have seen other teams do this and i was wondering if someone could post some code for it.
Thanks:D

dooey100 22-02-2009 20:49

Re: [FTC]: Light Senser
 
here is some basic code that will drive until your sensor hits the line:

Code:

motor[drive_right] = 100;      //start driving the motors
motor[drive_left] = 100;
while (SensorRaw[lightSensor] < tapeColor);      //keep driving until you run over the tape, tapeColor is a variable determined by the lighting and color of the tape, we used 340.
motor[drive_right] = 0;      //stop
motor[drive_left] = 0;


following the line is a bit tougher, the general idea is to go straight unless the light sensor goes off the line, if it does, turn until it is on the line again. Good luck getting it working, and if you need another hint, just ask!

gdo 23-02-2009 14:24

Re: [FTC]: Light Senser
 
On important thing is make sure you declare tapecolor with

int tapecolor = ____;

As for following the line, i would highly recommend two sensors for line following, just so you get a good tracking.


All times are GMT -5. The time now is 18:01.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi