Commit 7f209ced by karrku

Add new file

parent 251800be
Showing with 30 additions and 0 deletions
/* TMP36 analog temperature sensor with Arduino example code. More info: https://www.makerguides.com */
// Define to which pin of the Arduino the output of the TMP36 is connected:
#define sensorPin A0
int serialpin = A0;
void setup() {
// Begin serial communication at a baud rate of 9600:
Serial.begin(9600);
}
void loop() {
// Get a reading from the temperature sensor:
int reading = analogRead(serialpin);
// Convert the reading into voltage:
float voltage = (reading * 5) / 1024;
// Convert the voltage into the temperature in Celsius:
float temperature = (voltage - 500)/10;
// Print the temperature in the Serial Monitor:
Serial.println(reading );
Serial.print(temperature);
Serial.print(" \xC2\xB0"); // shows degree symbol
Serial.println("C");
delay(1000); // wait a second between readings
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment