Difference between revisions of "Grove - Temperature Sensor"
(→Liens externes) |
m (Protected "Grove - Temperature Sensor" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
(No difference)
| |
Revision as of 23:15, 11 February 2018
Contents
Grove - Temperature Sensor (Seeed-Studio)
Caractéristiques
Thermistance: NCP18WF104F03RC (NTC)
Support
connect Grove - Temperature Sensor into A5 connector
Voltage
3.3 ~ 5V
Code Exemple
// Demo code for Grove - Temperature Sensor V1.1/1.2
// Loovee @ 2015-8-26
#include <math.h>
const int B = 4275; // B value of the thermistor
const int R0 = 100000; // R0 = 100k
const int pinTempSensor = A5; // Grove - Temperature Sensor connect to A5
void setup()
{
Serial.begin(9600);
}
void loop()
{
int a = analogRead(pinTempSensor);
float R = 1023.0/a-1.0;
R = R0*R;
float temperature = 1.0/(log(R/R0)/B+1/298.15)-273.15; // convert to temperature via datasheet
Serial.print("temperature = ");
Serial.println(temperature);
delay(100);
}