calculate

Dependencies:   mbed X_NUCLEO_IKS01A3 Mahony_Algorithm

main.cpp

Committer:
zollecy1
Date:
2020-04-13
Revision:
1:48e219526d0f
Parent:
0:313fbc3a198a
Child:
2:4cccdc792719

File content as of revision 1:48e219526d0f:

/**
|**********************************************************************;
* 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%5.2f\t%5.2f\t%5.2f\r\n",(speed[0]*9.81)/1000, (speed[1]*9.81)/1000, (speed[2]*9.81)/1000);
        printf("pos: \t%5.2f\t%5.2f\t%5.2f\r\n",(pos[0]*9.81)/1000, (pos[1]*9.81)/1000, (pos[2]*9.81)/1000);
        printf("\r\n----------\r\n\n");
        wait_ms(500);
    }
}