Hmm, 5 weeks away and the boards are not here yet :( I got the LM75 boards though.
// wire is no hardware I2C but software
#include <Wire.h>
int t,l;
void setup() {
Wire.begin(); // pins 2 and 14 are SDA and SCL by default
Serial.begin(9600);
Serial.println("Reading the LM75");
}
void loop() {
Wire.write(0x00);
// 0x48 or 0xC8
// B1001111
Wire.requestFrom(0x48, 2);
while(Wire.available()) {
int8_t msb = Wire.read();
int8_t lsb = Wire.read();
// strip one bit of the lsb
lsb = (lsb & 0x80 ) >> 7; // now lsb = 0 or 1
// add to to form an float
float f = msb + 0.5 * lsb;
Serial.println(f,1);
}
delay(1000);
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.