I wanted to be able to use some DS18B20 OneWire temperature sensors, but as the Imp doesn’t yet support OneWire, I used a DS2482-100 to convert from I2C to OneWire. This added some complexity because all the OneWire commands have to be encapsulated in I2C messages. When you request data from a OneWire device, you have to request the data, wait for OneWire data to complete, then read the data from the buffer on the DS2482.
There are a handful of functions to send/receive OneWire data via the I2C commands, so the code for this example is ~400 lines long. For this reason, I have posted to code over at PasteBin rather than make a long long post here.
Output will look something like this:
8/4/2013 11:16:31 PM: OneWire Device D100000404BD2D28 = 77.3 °F 8/4/2013 11:16:34 PM: OneWire Device 5E00000404F90728 = 77.4 °F 8/4/2013 11:16:35 PM: OneWire Search Complete