תוכן
Find code and diagrams at: https://www.EliTheComputerGuy.com
You can use Analog Temperature Sensors in Arduino Projects to determine the temperature in your environment.
Functional Parts in the Project:
Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3
Breadboard Kit – https://amzn.to/2Xih5ei
Analog Temperature Sensor – https://amzn.to/2Rkkl3k
#define sensorPin A0
void setup()
{
Serial.begin(9600);
}
void loop()
{
int reading = analogRead(sensorPin);
float voltage = reading * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage – 0.5) * 100 ;
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(voltage); Serial.print(" volts – ");
Serial.print(temperatureC); Serial.print(" degrees C – ");
Serial.print(temperatureF); Serial.println(" degrees F");
delay(3000);
}