Writing the Software
To drive the Interface Kits, we will build an application that will allow a user to record a sequence of key presses representing the timing of lights turning on and off, save that recording, and then play it back without user intervention.
Software Requirements
First, the Phidget API must be installed so the application can communicate with the attached Phidget Interface Kit. This library is updated frequently, and occasionally changes are made that break existing code. Therefore, the specific version used for this project, can be found at the book's website: http://www.c4fbook.com/ or http://www.oreilly.com/catalog/9780596520748. If this isn't installed already, do this before continuing.
Software Implementation
As explained previously, the software that accompanies this project allows you to tap out a rhythm using the keyboard while the song is playing to turn individual strands of lights on and off to the music. To accomplish this, we need a way to record keystrokes and precise time intervals, a way to display that data, a way to save that data for later playback, and a way to play it back accurately so it matches the original timings. The next sections will talk about these important parts of the Light Sequencer application. The Light Sequencer software is far larger than what is contained in this chapter, but only the critical portions of the application will be discussed here. The full source code for the project can always be found on the book's website ...
Get Coding4Fun now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.