Hi. This is the feed program for Cosm. (The previous name of the services is Pachube.)
Dependencies: mbed ThermistorPack Pachube ConfigFile EthernetNetIf TextLCD HTTPClient_ToBeRemoved FatFileSystem SDFileSystem
ThermistorDummy.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 "ThermistorDummy.h" 00009 00010 ThermistorDummy::ThermistorDummy() 00011 : memory(getNextValue(MIN + ((MAX - MIN)/2))) { 00012 } 00013 00014 ThermistorDummy::~ThermistorDummy() { 00015 } 00016 00017 double ThermistorDummy::read() { 00018 memory = getNextValue(memory); 00019 return memory; 00020 } 00021 00022 double ThermistorDummy::getNextValue(double prev) { 00023 static const int THR = 5; 00024 int SCOPE = (MAX - MIN) + 1; 00025 int tmp = 0; 00026 do { 00027 tmp = (rand() % SCOPE) + MIN; 00028 } while (THR < abs(tmp - prev)); 00029 int udt = rand() % 10; 00030 return (double)tmp + (double)(udt * 0.1); 00031 }
Generated on Tue Jul 12 2022 18:41:21 by 1.7.2