StarBoard Orange - Example application No.1 GoogleChartLogger with StarBoard Orange

Dependencies:   EthernetNetIf mbed

Revision:
1:123eff9ba7b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sensor/SensorDummy.cpp	Wed Aug 11 10:24:25 2010 +0000
@@ -0,0 +1,27 @@
+/**
+ * Sensor interface driver. (Version 0.0.1)
+ *
+ * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
+ * http://shinta.main.jp/
+ */
+
+#include "SensorDummy.h"
+
+SensorDummy::SensorDummy() : memory(getNextValue(MIN + ((MAX - MIN)/2))) {}
+SensorDummy::~SensorDummy() {}
+
+double SensorDummy::read() {
+    memory = getNextValue(memory);
+    return memory;
+}
+
+double SensorDummy::getNextValue(double prev) {
+    static const int THR = 5;
+    int SCOPE = (MAX - MIN) + 1;
+    int tmp = 0;
+    do {
+        tmp = (rand() % SCOPE) + MIN;
+    } while (THR < abs(tmp - prev));
+    int udt = rand() % 10;
+    return (double)tmp + (double)(udt * 0.1);
+}