Regenerating PPM signal based on distances from ultrasonic sensors, ESP8266 for connectin via wifi. Autonomous quadcopter behaviour, autonomou height holding. Flying direction based on front and back ultrasonic sensors.

Dependencies:   ConfigFile HCSR04 PID PPM2 mbed-rtos mbed

Revision:
2:d172c9963f87
diff -r 3a5a074b39e0 -r d172c9963f87 SRFO2/srf02.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SRFO2/srf02.h	Thu Oct 26 15:54:47 2017 +0000
@@ -0,0 +1,42 @@
+#ifndef SRF02_H
+#define SRF02_H
+ 
+#include "mbed.h"
+ 
+ 
+/** Library to control SRF02 ultrasonic sensor */
+class SRF02
+{
+ public:
+    /** Creates an instance of the class
+    *
+    * @param sda I2C sda Pin
+    * @param scl I2C scl Pin
+    */
+    SRF02(PinName sda, PinName scl, int addr);
+  
+    /** Destroys instance */
+    ~SRF02();
+  
+    /** Read the range data in centimeters */
+    int readcm();     
+ 
+    /** Read the range data in inches */
+    int readinch();
+  
+    /** Change the adress of the device. This is very usefull when there are more sensors.
+    * This function must be executed with only one sensor conected.
+    */
+    void change_addr(char new_addr);
+  
+ private:
+    /** wait for ranging to complete
+    * This function is for internal use
+    */
+    void wait_ranging(void);                                        
+    I2C m_i2c;
+    int m_addr;
+ 
+};
+ 
+#endif
\ No newline at end of file