source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/libraries/Esplora/examples/Beginners/EsploraTemperatureSensor/EsploraTemperatureSensor.ino @ 46

Last change on this file since 46 was 46, checked in by jrpelegrina, 4 years ago

First release to Xenial

File size: 870 bytes
Line 
1/*
2  Esplora Temperature Sensor
3
4 This  sketch shows you how to read the Esplora's temperature sensor
5 You can read the temperature sensor in Farhenheit or Celsius.
6
7 Created on 22 Dec 2012
8 by Tom Igoe
9
10 This example is in the public domain.
11 */
12#include <Esplora.h>
13
14void setup()
15{
16  Serial.begin(9600);      // initialize serial communications with your computer
17}
18
19void loop()
20{
21  // read the temperature sensor in Celsius, then Fahrenheit:
22  int celsius = Esplora.readTemperature(DEGREES_C);
23  int fahrenheit = Esplora.readTemperature(DEGREES_F);
24
25  // print the results:
26  Serial.print("Temperature is: ");
27  Serial.print(celsius);
28  Serial.print(" degrees Celsius, or ");
29  Serial.print(fahrenheit);
30  Serial.println(" degrees Fahrenheit.");
31  Serial.println("     Fahrenheit = (9/5 * Celsius) + 32");
32
33  // wait a second before reading again:
34  delay(1000);
35}
36
37
Note: See TracBrowser for help on using the repository browser.