this code is for inverted pendulum balancer. it is based on two-loop PID controller. One controller is for Angle and another one is for velocity.

Dependencies:   HCSR04 L298HBridge mbed

Revision:
0:489498e8dae5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get_angle/get_angle.h	Fri Aug 25 21:10:23 2017 +0000
@@ -0,0 +1,20 @@
+//////////////////////////////////////////////////////////////////////////////////
+// Company: edinburgh of university
+// Engineer: ZEjun DU
+// 
+// Create Date: 2017/08/20 13:06:52
+// Design Name: Inverted Pendulum Balancer
+// Module Name: calculating real-time angle
+// Tool Versions: “Keil 5” or “Mbed Complie Online”
+// Description: this part is to get real-time angle from angle sensor
+//                           
+// 
+//////////////////////////////////////////////////////////////////////////////////
+#include "mbed.h"
+
+extern float angle;
+extern float angle_offset;
+extern AnalogIn angle_voltage;
+
+
+void angle_update(void);
\ No newline at end of file