Tuesday, April 23, 2013

testing, testing, testing



programming.

The first thing that we had to program was to turn the motor, and thus the pulley, and thus the lightbulb-terrarium 180 degrees. This is our first shot at it, without really controlling the speed, other than having it proportional to keep it from wobbling back and forth once it completed the turn. We'll go back in a bit to work to change the speed, because as is, it'll probably be too fast of a turn which will cause the terrarium itself to spin and possibly get tangled and maybe hit each other and all sorts of undesirable stuff. But after testing a bunch of gains...


Now, to integrate these movement subprograms into the main light sensing program.


Choosing an arbitrary value for "direct sunlight" (values < 20), we programmed the motor to turn away. Once it turns away, it wait until the sensor on the opaque side of the bulb is no longer experiencing "direct sunlight". The wait is in there because once it begins to turn away and goes into the 'then' subloop, sensor 3 will begin picking up that it isn't in direct sunlight, because the bulb has JUST begun to turn, so of course it isn't experiencing direct sunlight yet. A wait for the amount of time it takes for the bulb to turn keeps this from happening.

No comments:

Post a Comment