News

NXT – Stopping at the end of a line

In a Teacher workshop this week we were looking at ways of following a line. In these workshops I stick with a simple 'wiggle' algorithm just using a Switch statement and some Move Blocks. The group picked it up quickly and we had a little bit of time left at the end, so naturally the question arose, "How do we make it stop at the end?"
I took them through a few easy implementations, but when I got home, it occurred to me that we had a similar conversation on the mailing list last year - full discussion here
There were quite a few great solutions and ideas put forward (thanks Esther, Ian, Randall, Elwood, Amy and Jon) and I thought it might be useful to turn those ideas into actual code so teachers could get a better idea of how each worked.
Simple Line Following (No Stop)
Using the very basic line following program shown below, the robot will turn left to see the line and then right to avoid the line. Repeat this forever and the robot will 'wiggle' its way down the line.

Read More