Shinichiro Nakamura / ThermistorPack

Dependents:   Pachube_TestProgram ThermistorPack_TestProgram _DearMrJeffMourich StarBoardOrangeExpansion2 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ThermistorMCP9701.cpp Source File

ThermistorMCP9701.cpp

00001 /**
00002  * Thermistor interface driver. (Version 0.0.1)
00003  *
00004  * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
00005  * http://shinta.main.jp/
00006  */
00007 
00008 #include "ThermistorMCP9701.h"
00009 
00010 ThermistorMCP9701::ThermistorMCP9701(PinName pin)
00011         : analogInput(pin) {
00012 }
00013 
00014 ThermistorMCP9701::~ThermistorMCP9701() {
00015 }
00016 
00017 double ThermistorMCP9701::read() {
00018     /*
00019      * The value range of analogInput.read() is 0.0 to 1.0.
00020      */
00021     return (((analogInput.read() * 3.3) - 0.400) / 0.0195);
00022 }