On February 10th during the regular SCI183 class, we had an in-class assignment on experimenting with the light sensor of LEGO mindstorm. In the past, we had a couple of lectures practicing the NXT program using the LEGO mindstorm but this was the first time to do the experiment using a sensor.
Our assignment was to build a NXT program to let the mindstorm to follow a black line. The light sensor can read the color difference of black and white because the white color exceeds the level 50 of the light sensor, and the black is under 50. First, we built a car-like mindstorm machine with two motors on the side just like we built it in past classes. We connected each motor to port A and C. We programmed the action to let only Motor A move when the light reading is less than 50, and when the light reading is more than 50, Motor A stops and Motor C runs for 0.25 seconds. The entire motion is infinitely looped.
Our group cooperated with each other to build the machine and to do the experimentation. This was the second time we built the mindstorm to a car-like machine with two motors so it did not take very long time to build the machine. In the first experiment, the machine moved backwards so it could not find the line. We needed to figure out why our machine was moving backwards and we got advice from the other group who had the same problem. In the second experiment, the machine successfully followed the line. The mindstorm programming assignment requires cooperation with classmates so this is not only a learning programming but a lesson in communication skills. So far, our group could finish the assignment during class and achieved the knowledge of how the light sensor and NXT programming collaborate together.
Pictures from
https://allencentre.wikispaces.com/LEGO+Mindstorms
http://www.robotshop.ca/lego-mindstorms-nxt-light-sensor-1.html