|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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! Last edited by dooey100 : 22-02-2009 at 20:53. |
|
#3
|
||||
|
||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Crio network light does not light when camera plugged in | Bongle | Programming | 16 | 16-01-2009 11:00 |
| [FTC]: FTC]: FTC Champ Tournament - Ontario (Scoring Breakdown) | Mr. Lim | FIRST Tech Challenge | 2 | 03-03-2008 11:54 |
| [FTC]: [FTC]: Ontario Provincial FTC Start/End Times | cbhl | FIRST Tech Challenge | 8 | 16-12-2007 13:37 |
| Multiple Light Tracking with Distinct Light Boxes in EasyC | hal | Programming | 1 | 19-02-2007 11:56 |
| camera trouble,cant tell the green-light from regular white light | Nimmy | Programming | 26 | 14-01-2007 14:53 |