Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.
Lambor edited this page Nov 27, 2017 · 1 revision

Welcome to the Wio_LTE_Arduino_Library wiki!

Using Grove Modules

Grove Temperature

void get_temp() {
  int t_int;
  int t_float;
  float t = 0.0, R0 = 0.0, R1 = 100000, B = 3975;
  int a = 0;

  // pinMode(adc_in, INPUT_ANALOG);
  a = analogRead(TEMP_PIN);
  R0 = R1*(4096.0/a - 1.0);  // Calculate NTC's resistance   
  t = 1.0/(log(R0/R1)/B+1/298.15)-273.15;
  t_int = (int)t;
  t_float = (t - t_int)*100;
  SerialUSB.print("Tempreture: ");
  SerialUSB.println(t);
  sprintf(temperature, "%d.%d", t_int, t_float);
  
}

Clone this wiki locally