Simple program for introduction of mirror actuator.

Committer:
altb2
Date:
Sat May 01 20:08:51 2021 +0000
Revision:
14:1be03d1c45c7
Parent:
13:1bf960928a93
2nd commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb2 0:a56e9c932891 1 #include "mbed.h"
altb2 0:a56e9c932891 2 #include "LinearCharacteristics.h"
altb2 5:768e10f6d372 3 #include "ControllerLoop.h"
altb2 6:9ebeffe446e4 4 static BufferedSerial serial_port(USBTX, USBRX);
altb2 13:1bf960928a93 5 DigitalOut led(LED1);
altb2 13:1bf960928a93 6 // The controller Thread
altb2 13:1bf960928a93 7 float Ts = 0.2;
altb2 13:1bf960928a93 8 LinearCharacteristics gyro(0,1,-400,400);
altb2 6:9ebeffe446e4 9
altb2 10:bfacffec199a 10 ControllerLoop loop(Ts); // this is forthe main controller loop
altb2 0:a56e9c932891 11 //******************************************************************************
altb2 0:a56e9c932891 12 //---------- main loop -------------
altb2 0:a56e9c932891 13 //******************************************************************************
altb2 0:a56e9c932891 14 int main()
altb2 0:a56e9c932891 15 {
altb2 6:9ebeffe446e4 16 serial_port.set_baud(115200);
altb2 6:9ebeffe446e4 17 serial_port.set_format(
altb2 6:9ebeffe446e4 18 /* bits */ 8,
altb2 6:9ebeffe446e4 19 /* parity */ BufferedSerial::None,
altb2 6:9ebeffe446e4 20 /* stop bit */ 1
altb2 6:9ebeffe446e4 21 );
altb2 13:1bf960928a93 22 printf("gyro ( 0.2) = %f\r\n",gyro(0.2));
altb2 6:9ebeffe446e4 23 serial_port.set_blocking(false); // force to send whenever possible and data is there
altb2 10:bfacffec199a 24 loop.start_loop();
altb2 13:1bf960928a93 25
altb2 10:bfacffec199a 26 while(1)
altb2 13:1bf960928a93 27 {
altb2 13:1bf960928a93 28 ThisThread::sleep_for(1000);
altb2 5:768e10f6d372 29 }
altb2 0:a56e9c932891 30 } // END OF main