Skip to content

Instantly share code, notes, and snippets.

View dedeweb's full-sized avatar

Denis Messié dedeweb

  • Grenoble, France
View GitHub Profile
import 'dart:math';
void main() {
var adcRaw = 3120;
var rawValue = (adcRaw * 3.2) / 4096;
var rT = (3.2 * 60400) / (3.2 - rawValue) - 60400;
var tempKelv = 4250 * 298 / (4250 + 298 * (log(rT / 1000) - log(100)));
var degC = tempKelv - 273.15; //to deg celciuss
var correctDegC = (degC -2.2007)/0.907;
print(correctDegC);
@dedeweb
dedeweb / main.dart
Last active March 27, 2020 08:57
temp
import 'dart:math';
double computeTemp(int adcRaw) {
var rawValue = (adcRaw * 3.2) / 4096;
var rT = (3.2 * 60400) / (3.2 - rawValue) - 60400;
var tempKelv =
4250 * 298 / (4250 + 298 * ( log(rT / 1000) - log(100)));
return tempKelv - 273.15; //to deg celcius
}