calculate

Dependencies:   mbed X_NUCLEO_IKS01A3 Mahony_Algorithm

main.cpp

Committer:
zollecy1
Date:
2020-04-15
Revision:
2:4cccdc792719
Parent:
1:48e219526d0f
Child:
3:795998b31c32

File content as of revision 2:4cccdc792719:

            /**
|**********************************************************************;
* Project           : Projektarbeit Systemtechnik PES4
*
* Program name      : ................
*
* Author            : PES4 Team1
*
* Team              : **Team 1**
*                     Fabio Bernard
*                     Lukas Egli
*                     Matthias Ott
*                     Pascal Novacki
*                     Robin Wanner
*                     Vincent Vescoli
*                     Cyrill Zoller
*
* Date created      : 20.02.2020
*
* Purpose           : Main
*
|**********************************************************************;
**/

#include "mbed.h"
#include "CalculateData.h"


//initialise DigitalIO
DigitalOut myled(LED1);
DigitalIn user_button(USER_BUTTON);


//Generate object
CalculateData calculate(D14, D15, D4, D5, A3, D6, A4);

int pos[3];
int speed[3];
int acc[3];

int main(){
    calculate.enable();
    while(1){    
        calculate.run();
        calculate.getAccelerometer(acc);
        calculate.getSpeed(speed);
        calculate.getPosition(pos);
        
        printf("\r\n----------\r\n\n");
        printf("Accelerometer: \t%5.2f\t%5.2f\t%5.2f\r\n",(double)acc[0], (double)acc[1], (double)acc[2]);
        printf("Speed: \t\t%5.2f\t%5.2f\t%5.2f\r\n",(double)speed[0], (double)speed[1], (double)speed[2]);
        printf("pos: \t\t%5.2f\t%5.2f\t%5.2f\r\n%i",(double)pos[0], (double)pos[1], (double)pos[2], calculate.t);
        printf("\r\n----------\r\n\n");
        wait_ms(1000);
    }
}