no thread

Dependents:   200_yotuba_21_uiChange

Revision:
2:35b3dd6f7f17
Parent:
0:d0a252247fec
Child:
4:004bdb88ab3e
--- a/IRsensor.h	Tue Jun 25 08:45:06 2019 +0000
+++ b/IRsensor.h	Thu Aug 22 06:09:57 2019 +0000
@@ -6,12 +6,29 @@
 class IRsensor{
  public:
     IRsensor(PinName pin);
-    float getDistance(int n);
+    float getDistance();
+    float get_Averagingdistance();
+    void startAveraging(uint8_t averaging_range);
 
 private:
-    float getInputvoltage();
-    float changeVtoD(float voltage);
+    void threadloop_get_distance();
+    void threadloop_averaging_distance();
+    void compute_distance();
+    void getInputvoltage();
+    void changeVtoD();
+    void computeaverage();
+    
+    float voltage;
+    float originaldistance;
+    float* data;
+    float distance_sum;
+    float distance_average;
+    uint8_t bufferSize;
+    uint8_t bufferpoint;
+    Thread thread_get_distance;
+    Thread thread_averaging_distance;
     AnalogIn a_in;
+
 };
 
 #endif