Skip to content

Instantly share code, notes, and snippets.

@zach-c-d
Created February 1, 2016 17:13
Show Gist options
  • Save zach-c-d/771cabe16f84673537e3 to your computer and use it in GitHub Desktop.
Save zach-c-d/771cabe16f84673537e3 to your computer and use it in GitHub Desktop.
int tempPin = 9;//temperature sensor is in pin 0
float tempC = 0; //stores temperature sensor input data
void setup() {
analogReference(INTERNAL);
Serial.begin(9600); //opens serial communication
pinMode(tempPin, INPUT);
}
void loop() {
tempC = analogRead(tempPin); //reads tempPin data and stores in tempC
//tempC = (5*tempC*100.0)/1024.0; //converts tempPin data to celsius
Serial.println(tempC);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment