Pixy2 Quick Links
Basics
Connecting Pixy2 to…
Pixy2 Modes / Programs
Software and Support
Basics
Connecting Pixy2 to…
Pixy2 Modes / Programs
Software and Support
This page describes how to make a LEGO robot that follows lines and makes turns at intersections as instructed. It's meant to be a basic introduction to the Pixy2's line following abilities.
The robot we're going to build can be found in Laurens Valk's book LEGO Mindstorms EV3 Discovery Book. The robot is called the Explor3r and it uses parts that are available in the retail Mindstorms EV3 kit.
If your line drawing has an intersection, you can tell your robot always turn left or always turn right (for example) by “hard-coding” the Turn Angle. With the program stopped, try setting the Turn Angle to -90 degrees.
-90 degrees is a right turn according to the diagram below.
Re-run the program and notice that when it sees the intersection it will choose the right-most branch of the intersection and continue. In other words, it will always turn right when encountering an intersection. And more specifically, it will choose the branch that is closest to -90 degrees. Try setting the angle to 90 degrees and see what happens.
Can you extend this demo to make turns based on barcodes? Barcode images (including roadsigns!) are available here.