From e87a8d64cb3263ba39baa61b5f6e03b3a456c0e4 Mon Sep 17 00:00:00 2001 From: PurpleRose Date: Sun, 17 Jan 2021 22:55:30 +0000 Subject: [PATCH] Upload files to 'ArduinoScript' --- ArduinoScript/readTempValuesFromArduino.ino | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ArduinoScript/readTempValuesFromArduino.ino diff --git a/ArduinoScript/readTempValuesFromArduino.ino b/ArduinoScript/readTempValuesFromArduino.ino new file mode 100644 index 0000000..ecab578 --- /dev/null +++ b/ArduinoScript/readTempValuesFromArduino.ino @@ -0,0 +1,21 @@ +int sensePin = A0; //This is the Arduino Pin that will read the sensor output +int sensorInput; //The variable we will use to store the sensor input +double temp; //The variable we will use to store temperature in degrees. + +void setup() { + // put your setup code here, to run once: +Serial.begin(9600); + +} + +void loop() { + // put your main code here, to run repeatedly: + +sensorInput = analogRead(A0); //read the analog sensor and store it + temp = (double)sensorInput / 1024; //find percentage of input reading + temp = temp * 5; //multiply by 5V to get voltage + temp = temp - 0.5; //Subtract the offset + temp = temp * 100; //Convert to degrees + Serial.println(temp); //Print to serial port + delay(30000); //30secs*1000milisecs +}