tmp102 1.0.0

Driver for the Texas Instruments TMP102 digital temperature senor (for Linux)
Documentation
  • Coverage
  • 0%
    0 out of 8 items documented0 out of 4 items with examples
  • Size
  • Source code size: 14.21 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 762.38 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • andygrove/tmp102-rs
    4 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andygrove

tmp102-rs

Rust library for the Texas Instruments TMP102 digital temperature sensor.

This library will only compile on Linux and has only been tested on the Raspberry Pi and with this TMP102 breakout: https://www.sparkfun.com/products/11931

extern crate tmp102;

use tmp102::{TMP102, TempScale};

fn main() {
    // address 0x48 assumes ADR0 is connected to GND
    let mut tmp = TMP102::new("/dev/i2c-1", 0x48).unwrap();
    println!("Temperature is {}", tmp.read(TempScale::Fahrenheit).unwrap());
}

If you are not sure what address the device is using, just use i2cdetect.

$ i2cdetect  -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --