Ermis Gasetopulos / m3pi_TUB2

Fork of m3pi_TUB by TUB-MRT

Files at this revision

API Documentation at this revision

Comitter:
ErmGas
Date:
Sat Jan 30 22:26:00 2016 +0000
Parent:
15:954081ec1a2d
Commit message:
republished copy of the m3pi_TUB library

Changed in this revision

m3pi_ng.cpp Show annotated file Show diff for this revision Revisions of this file
m3pi_ng.h Show annotated file Show diff for this revision Revisions of this file
--- a/m3pi_ng.cpp	Wed Jul 22 12:43:54 2015 +0000
+++ b/m3pi_ng.cpp	Sat Jan 30 22:26:00 2016 +0000
@@ -245,6 +245,22 @@
     return(_ser.getc());
 }
 
+void m3pi::readsensor (int *sensor){
+   
+   _ser.putc(SEND_CALIBRATED_SENSOR_VALUES);  
+    sensor[0] = _ser.getc();
+    sensor[0] += _ser.getc() << 8;
+    sensor[1] = _ser.getc();
+    sensor[1] += _ser.getc() << 8;
+    sensor[2] = _ser.getc();
+    sensor[2] += _ser.getc() << 8;
+    sensor[3] = _ser.getc();
+    sensor[3] += _ser.getc() << 8;
+    sensor[4] = _ser.getc();
+    sensor[4] += _ser.getc() << 8;
+  
+    return;
+}
 
 
 
--- a/m3pi_ng.h	Wed Jul 22 12:43:54 2015 +0000
+++ b/m3pi_ng.h	Sat Jan 30 22:26:00 2016 +0000
@@ -241,6 +241,13 @@
      * @param int The character to send to the 3pi
      */
     int print(char* text, int length);
+    
+    /**
+    * Read the calibrated value of a sensor
+    * @param sensor Pointer to array sensor [0-4]
+    * @param values returned in the range 0-1000 where 1000=completely dark
+    */
+    void readsensor(int *sensor);
 
 #ifdef MBED_RPC
     virtual const struct rpc_method *get_rpc_methods();