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

Committer:
dudu941014
Date:
Fri Aug 25 21:25:46 2017 +0000
Revision:
1:ce626b794a6c
Parent:
0:489498e8dae5
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.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudu941014 0:489498e8dae5 1 //////////////////////////////////////////////////////////////////////////////////
dudu941014 0:489498e8dae5 2 // Company: edinburgh of university
dudu941014 0:489498e8dae5 3 // Engineer: ZEjun DU
dudu941014 0:489498e8dae5 4 //
dudu941014 0:489498e8dae5 5 // Create Date: 2017/08/20 13:06:52
dudu941014 0:489498e8dae5 6 // Design Name: Inverted Pendulum Balancer
dudu941014 0:489498e8dae5 7 // Module Name: commnication with GUI
dudu941014 0:489498e8dae5 8 // Tool Versions: “Keil 5” or “Mbed Complie Online”
dudu941014 0:489498e8dae5 9 // Description: this funcition is to commucation with GUI through Bluetooth HC05
dudu941014 0:489498e8dae5 10 // the system can invoke this function to send the packet and decode the result
dudu941014 0:489498e8dae5 11 //
dudu941014 0:489498e8dae5 12 //
dudu941014 0:489498e8dae5 13 //////////////////////////////////////////////////////////////////////////////////
dudu941014 0:489498e8dae5 14
dudu941014 0:489498e8dae5 15 /* Bluetooth(HC-06) example on LPC1768
dudu941014 0:489498e8dae5 16 *
dudu941014 0:489498e8dae5 17 * @author: Zejun Du
dudu941014 0:489498e8dae5 18 *--------------------------------------------------------------
dudu941014 0:489498e8dae5 19 * |LPC1768| |Peripherals|
dudu941014 0:489498e8dae5 20
dudu941014 0:489498e8dae5 21 *---------------------------------------------------------------
dudu941014 0:489498e8dae5 22 */
dudu941014 0:489498e8dae5 23
dudu941014 0:489498e8dae5 24 #include "mbed.h"
dudu941014 0:489498e8dae5 25
dudu941014 0:489498e8dae5 26 extern int i;
dudu941014 0:489498e8dae5 27
dudu941014 0:489498e8dae5 28 extern Serial bluetooth;
dudu941014 0:489498e8dae5 29 extern DigitalOut led1;
dudu941014 0:489498e8dae5 30 extern DigitalOut led2;
dudu941014 0:489498e8dae5 31 extern DigitalOut led3;
dudu941014 0:489498e8dae5 32 extern DigitalOut led4;
dudu941014 0:489498e8dae5 33
dudu941014 0:489498e8dae5 34 void Send_Messge(void);
dudu941014 0:489498e8dae5 35 void commander(void);