first commit
This commit is contained in:
commit
a5a0434432
1126 changed files with 439481 additions and 0 deletions
15
Software/NodeJS/libs/sensors/temperatureAnalogSensor.js
Normal file
15
Software/NodeJS/libs/sensors/temperatureAnalogSensor.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
var AnalogSensor = require('./base/analogSensor')
|
||||
var commands = require('../commands')
|
||||
|
||||
function TemperatureAnalogSensor(pin) {
|
||||
AnalogSensor.apply(this, Array.prototype.slice.call(arguments))
|
||||
}
|
||||
TemperatureAnalogSensor.prototype = new AnalogSensor()
|
||||
|
||||
TemperatureAnalogSensor.prototype.read = function() {
|
||||
var res = AnalogSensor.prototype.read.call(this)
|
||||
var resistance = (1023-res) * 10000 / res
|
||||
return (1 / (Math.log(resistance / 10000) / 3975 + 1 / 298.15) - 273.15)
|
||||
}
|
||||
|
||||
module.exports = TemperatureAnalogSensor
|
||||
Loading…
Add table
Add a link
Reference in a new issue