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

stabilizer/stabilizer.h

Committer:
dudu941014
Date:
2017-08-25
Revision:
0:489498e8dae5

File content as of revision 0:489498e8dae5:

//////////////////////////////////////////////////////////////////////////////////
// Company: edinburgh of university
// Engineer: ZEjun DU
// 
// Create Date: 2017/08/20 13:06:52
// Design Name: Inverted Pendulum Balancer
// Module Name: basic PID algorithm
// Tool Versions: “Keil 5” or “Mbed Complie Online”
// Description: this funcition is to control and manage the PID mode
//              the main loop only need to invoke this module's funcition 
// 
//////////////////////////////////////////////////////////////////////////////////

#ifndef STABILIZER_H
#define STABILIZER_H

#include "mbed.h"
#include "L298HBridge.h"

extern float M_Thr;
extern float M_Alt;
extern int PID_ctrl;
extern int Velocity_ctrl;

void stabilize_task(void);

#endif