Today we expanded upon the sculpture we made on Day 1 using "edge" and "level" triggered logic. Level triggered logic means that an action will run unless there is a change in circumstance. For example, a motor will run one way until a button is pressed, and then it will go in reverse as long as the button is held down. Edge triggered logic means that as soon as the button is pressed the motor will reverse, and holding down or letting go of the button won't change the action--one must unpress the button and press it again to change the action.
Above is a video of our train. Two actions are occurring at the same time: 1) The light is changing from orange to light yellow to dark red to purple as we change the light hitting a light sensor, simulating the change in light over a 24 hour period (dawn, day, evening, and night). 2) The motor doesn't start until a button is pressed, and then as we keep pressing the button it reverses, stops, and then starts up again. Both of these actions are edge triggered--they occur as soon as we press the button or change the light over the sensor.
The first image is the program we wrote for the changing lights. One can clearly see the progression from daylight to night to dawn, which will repeat "forever" as long as we keep the program running. We named this program "DY&Nt." Similarly, our second program, entitled "SqW," or "Squeaky Wheels," which controls the motion of the motor, is set to run "forever."
Put together, the programs tell a nice, little tale of a female conductor who starts her train in the morning, rides around during the day, reverses back home in the evening, and stops at night.