![]() |
|||
| ITJ
version 2.0 - System Diagram: The Tower PIC checks each of 8 switches connected to it. If a case has been inserted into a slot, one of the contacts on the case closes a switch that is connected to the tower and corresponds with that slot. Each time the Tower PIC finds that a slot is occupied (i.e., the slot's switch is on), it sends the character "?" to the case in that slot (via one of the other contacts on that case), and then immediately waits for data to return from that same pin. The case PIC, which has been waiting for serial input this whole time, receives the character "?" and sends back its "name," which is a single character, on the same pin. The Tower PIC receives the name of the case in the slot, stores it, and moves on to the next case, going on through all 8 slots. After
the Tower has a value for all 8 slots, it also samples the analog input
coming in from the volume knob, and then outputs a formatted string with
all 8 slot names (it sends a "0" if the slot is empty) and the
volume back to the computer. The computer reads in the data, updates its
own variables, and determines what to tell iTunes to do. The computer
then determines what color each of the cases in the tower should be, and
begins to tell the Tower how to light them. The computer tells the Tower
to light a case by first sending the slot number. The Tower stores that
slot number and applies any further instructions it gets from the computer
to the case in that slot. The computer sends a character (possible values
are "a" through "h") to the Tower PIC to tell it which
color to tell the case to turn.The Tower PIC sends the appropriate character
to the currently selected slot to tell it to turn the correct color. System Diagram |
|||