View gist:99735e69d4bb2a67ca25efe3041f003e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |