Richard Irons March 11, 2003
91.548 Robotics I
Lab 2: The Handy Cricket
For Exercise 5 of Lab 2, I created a Cricket Logo program that sent photocell sensor data to the serial port. I also created an OpenGL program using the OpenGL toolkit GLUT to open the serial port COM1, read the photocell sensor data that the Cricket was sending, and to display the sensor data in a graphical fashion. The program created numerous filled circles on the XY plane and rotated then together around the Z axis centered at the middle of the window. The number of circles created was determined by the size of the window. Only enough circles to fill the OpenGL window were created.
The effect that the sensor data had on the circles was that the circles would increase in scale with sensor values indicating increasing amounts of light. The circles would decrease in scale with sensor values indicating decreasing amounts of light. The photocell sensor data read from the Cricket was inverted so that the sensor values that indicated the absence of light were made low and the sensor values that indicated the presence of light were made high. The scale of the circles would be changing while at the same time all of the circles would be rotating around the Z axis.
I calculate a scale for the circles by dividing the inverted sensor value by 192. This produces a circle scale in the range of 0 to approximately 1.3. Also, all of the serial port communication code within the program (open serial port, setting attributes of serial port, and reading from the serial port) was copied from Microsoft online help.
I thought the display was interesting, but the performance of the animation could get slow.
Steps for Constructing Exercise (Win32 only):