Pooja Baraskar
Published © GPL3+

Grove Starter Kit With Intel Galileo Gen 2: Getting Started

This article explains the Grove Starter Kit with Intel Galileo Gen 2.

BeginnerProtip1,151
Grove Starter Kit With Intel Galileo Gen 2: Getting Started

Things used in this project

Story

Read more

Code

Untitled file

C/C++
// Define the pin to which the temperature sensor is connected.  
const int pinTemp = A0;  
  
// Define the B-value of the thermistor.  
// This value is a property of the thermistor used in the Grove - Temperature Sensor,  
// and used to convert from the analog value it measures and a temperature value.  
const int B = 3975;  
  
void setup()  
{  
    // Configure the serial communication line at 9600 baud (bits per second.)  
    Serial.begin(9600);  
}  
  
void loop()  
{  
    // Get the (raw) value of the temperature sensor.  
    int val = analogRead(pinTemp);  
  
    // Determine the current resistance of the thermistor based on the sensor value.  
    float resistance = (float)(1023-val)*10000/val;  
  
    // Calculate the temperature based on the resistance value.  
    float temperature = 1/(log(resistance/10000)/B+1/298.15)-273.15;  
  
    // Print the temperature to the serial console.  
    Serial.println(temperature);  
  
    // Wait one second between measurements.  
    delay(1000);  
} 

Credits

Pooja Baraskar
25 projects • 178 followers
Pooja Baraskar is an accomplished software engineer, inventor, and technical author with over a decade of experience in the tech industry.

Comments