public double Temperature() { // reset the bus Ow.TouchReset(); // address the device Ow.WriteByte(SkipROM); // read the data from the sensor Ow.WriteByte(ReadScratchPad); // read the two bytes of data short data = (short)Ow.ReadByte(); //data |= (ushort)(Ow.ReadByte() << 8); // MSB data += (short)(((short)Ow.ReadByte()) << 8); // reset the bus, we don't want more data than that Ow.TouchReset(); // returns °C // F would be: (float)((1.80 * (data / 16.00)) + 32.00); return(data / 16.0); }
public bool StartConversion() { // if reset finds no devices, just return 0 if (Ow.TouchReset() == 0) { return(false); } // address the device Ow.WriteByte(SkipROM); // tell the device to start temp conversion Ow.WriteByte(StartTemperatureConversion); return(true); }