Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:3fbb3fa4ff64
- Child:
- 1:3d46a0660d05
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 12 06:58:18 2019 +0000 @@ -0,0 +1,82 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: main.cpp + * Author: kwieg + * + * Created on February 28, 2019, 7:54 PM + */ + +#include <cstdlib> +#include <math.h> +#include "mbed.h" +#include "Sensor.h" +#include "Filtered_data.h" +#include "DataStore.h" +#include "ComplementaryFilter.h" +#include "PID_caller.h" +#include "Force_to_wing_angle.h" +//DigitalIn button(USER_BUTTON); +DigitalOut led(LED2); +using namespace std; + +/* + * main. + */ +int main(int argc, char** argv) { + + // Maak de objecten. + DataStore * ruwe_data = new DataStore(); + DataStore * filtered_data = new DataStore(); + DataStore * complementary_data= new DataStore(); + DataStore * pid_data = new DataStore(); + DataStore * FtoW_data = new DataStore(); + Sensor * de_sensor = new Sensor(); + RuwDataFilter * filter = new RuwDataFilter(); + ComplementaryFilter * com_filter = new ComplementaryFilter(); + PID_caller * PID =new PID_caller(); + control::ForceToWingAngle * FtoW = new control::ForceToWingAngle(); + + + // De associaties, de verbindingen tussen de objecten. + de_sensor->m_ruwe_state_data = ruwe_data; // (1) + filter->m_ruwe_state_data = ruwe_data; // (2) + filter->m_filtered_data = filtered_data; // (3) + com_filter->m_filtered_data = filtered_data; //(4) + com_filter->m_complementary_data = complementary_data; //(5) + PID->m_complementary_data=complementary_data; //(6) + PID->m_PID_data=pid_data; //(7) + FtoW->m_complementary_data=complementary_data; //(8) + FtoW->m_PID_data=pid_data; //(9) + FtoW->m_FtoW_data=FtoW_data; //(10) + + + de_sensor->get_data(); + int N=0; + while (N < 100) { + led = !led; + filter->FilterIt(); + com_filter->CalculateRealHeight(); + PID->PID_in(); + FtoW->MMA(); + de_sensor->get_data(); + N=N+1; + } + + // Als de klus klaar is ruim de objecten op. + delete (ruwe_data); + delete (filtered_data); + delete (pid_data); + delete (de_sensor); + delete (filter); + delete (complementary_data); + delete (PID); + delete (com_filter); + delete (FtoW); + + return 0; +} \ No newline at end of file