Project:Traffic Lights

From London Hackspace Wiki
Revision as of 20:43, 19 February 2012 by Fridgehead (talk | contribs) (Babbage Daemon)
Jump to: navigation, search

USB Traffic Lights

The traffic lights above Lovelace are currently connected to Babbage via USB. Theyre a USB HID device (Vendor ID 0x03EB, ProductID = 0x2044 - LUFA stack testing vid/pid) that is controlled by a Daemon running on Babbage.

To control them directly you need to send a Set_Report request to the Control Endpoint with the data part being 8 bytes long. The first 3 bytes are uints that represent the 3 lights, the rest of the values can be left as zero. A non-zero value means the light is on

You can also read from the first Interrupt Endpoint to get a report of the current light status.

Babbage Daemon

The daemon running on Babbage (under my account) listens for UDP packets on port 9009. Simply send a 3 character string terminated by carriage return and newline to set the light status, for example:

100\r\n <- green light on

101\r\n <- green and red lights on<p> This daemon handles the USB stuff for you.

Current uses

Since I changed the API none of the IRC commands that use the lights work.

There is a doorbot listener on babbage that listens for unknown cards at the door and blinks the Red light 5 times. It Erases the current light state after doing this