Difference between revisions of "Grove - Temperature Sensor"
(→Liens externes) |
|||
| Line 10: | Line 10: | ||
=== Voltage === | === Voltage === | ||
3.3 ~ 5V | 3.3 ~ 5V | ||
| + | === Port === | ||
| + | A0 | ||
=== Code Exemple === | === Code Exemple === | ||
<pre> | <pre> | ||
| Line 19: | Line 21: | ||
const int B = 4275; // B value of the thermistor | const int B = 4275; // B value of the thermistor | ||
const int R0 = 100000; // R0 = 100k | const int R0 = 100000; // R0 = 100k | ||
| − | const int pinTempSensor = | + | const int pinTempSensor = A0; // Grove - Temperature Sensor connect to A0 |
void setup() | void setup() | ||
Revision as of 23:28, 21 March 2020
Contents
Grove - Temperature Sensor (Seeed-Studio)
Caractéristiques
Thermistance: NCP18WF104F03RC (NTC)
Support
connect Grove - Temperature Sensor into A5 connector
Voltage
3.3 ~ 5V
Port
A0
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 = A0; // Grove - Temperature Sensor connect to A0
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);
}