Created
January 10, 2012 01:43
-
-
Save willasaywhat/1586278 to your computer and use it in GitHub Desktop.
Arduino 22 - TC74 Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#define i2c_addr 0x4F | |
void setup() { | |
Serial.begin(9600); | |
Wire.begin(); | |
} | |
void loop() { | |
Serial.print("reading:"); | |
Wire.beginTransmission(i2c_addr); | |
Wire.send((uint8_t) 0); | |
Wire.endTransmission(); | |
Wire.requestFrom(i2c_addr, 1); | |
int tempC = Wire.receive(); | |
Serial.print(tempC); | |
Serial.print(" degrees C; "); | |
int tempF = (tempC * 1.8) + 32; | |
Serial.print (tempF); | |
Serial.println(" degrees F"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you