Created
March 30, 2020 03:10
-
-
Save jpliew/5a6b78cb65b5f036285ffba18d7f531a to your computer and use it in GitHub Desktop.
Tutorial 4 - 1A
This file contains 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
int analogInPin = A0; // Analog input pin that the potentiometer is attached to | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
int rawvoltage= analogRead(analogInPin); | |
float millivolts= rawvoltage * (5000/1023.0); | |
float kelvin= (millivolts/10); | |
Serial.print(millivolts); | |
Serial.print(" mV\t"); | |
Serial.print(kelvin); | |
Serial.print(" Kelvin\t"); | |
float celsius= kelvin - 273.15; | |
Serial.print(celsius); | |
Serial.println(" Celsius"); | |
delay(300); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment