EasyManua.ls Logo

Thames & Kosmos Code Gamer - CALCULATING IN THE PROGRAM; Basic Arithmetic Operations

Thames & Kosmos Code Gamer
66 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SO CHANGE YOUR PROGRAM LIKE THIS:
Close the serial monitor, upload the program, and reopen
the serial monitor. You will see that the current
temperature is now being output at regular intervals.
#include <KosmoBits_Pins.h>
#include <KosmoBits_Thermistor.h>
const int sensorPin = KOSMOBITS_SENSOR_PIN;
void setup() {
pinMode(sensorPin, INPUT);
Serial.begin(115200); // Enable output via
// serial monitor.
}
void loop() {
int measurement = analogRead(sensorPin);
float celsius = thermistor_measurement_in_
celsius(measurement); // C o n v e r t
// measurement into degrees Celsius.
Serial.print(celsius); // Celsius value
// is output.
Serial.println(" degrees Celsius"); // Output
// of"Degrees Celsius" and line break.
delay(1000);
}
</>

PROJECT 8
CodeGamer manual inside english.indd 34 7/19/16 12:32 PM