Skip to content

Commit

Permalink
temperature_sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
IndranjanaChatterjee committed Oct 10, 2023
1 parent 6abce77 commit 53af20d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"GitHooks.hooksDirectory": "c:\\Users\\Indranjana\\OneDrive\\Desktop\\contains\\Arduino-Codes\\.git\\hooks"
}
18 changes: 18 additions & 0 deletions Temperature_sensor/Temperature_sensor.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
float temp;
int pin = 0;

void setup() {
Serial.begin(9600);
}

void loop() {
temp = analogRead(pin);
// read analog volt from sensor and save to variable temp
temp = temp * 0.48828125;
// convert the analog volt to its temperature equivalent
Serial.print("TEMPERATURE = ");
Serial.print(temp); // display temperature value
Serial.print("*C");
Serial.println();
delay(1000); // update sensor reading each one second
}

0 comments on commit 53af20d

Please sign in to comment.