If you're up for a programming challenge the 3Pi robot is capable of following lines (and they can do it really fast!). Luckily Anibit includes an example you can try:
Its a lot to understand, but if you want to jump ahead a bit you can start by loading the following XML file (these bits do calibration and battery display so you don't need to worry about them too much).
Start with an infinite repeat:
Each repeat, do the following:
(display is if you want to)
Then make a decision based on the sensor
Greater than 2000 means the line is on the left, less than means the line is on the right
Here's a diagram to explain what the sensor gives you:
The simplest thing is to turn on the motors based on which side of the line you are on:
If you want to move more smoothly you can try making even more decisions:
No comments:
Post a Comment