Step 7: Build and Program the yarn dispenser's circuit

Picture of Build and Program the yarn dispenser's circuit
When the correct signal is received, the yarn dispenser releases twelve feet of yarn (approximately the length of a half-lap around the track. You can reprogram the circuit as you wish to dispense any length.

Build the circuit in the diagram below, and program it with the provided code. I determined what twelve feet of yarn was by simply timing it with a stop-watch. The code runs the motor for that amount of time (converted into milliseconds).

For convenience, I built my circuit with an H-Bridge -- an IC chip that can switch the direction of a motor. The H-Brige's direction is determined by a toggle switch. Here is a tutorial about h-bridges.
Won't the length of the yarn dispensed change as the spool runs out? I would imagine that x-number of seconds dispensed from a full spool will yield a lot more yarn than the same number of seconds dispensed from an almost empty spool. Can you compensate for that in the receiver? Perhaps I'll go ponder it whilst I pace back and forth in my living room. :-) Very cool instructable!