test

Dependencies:   PM2_Libary Eigen

main.cpp

Committer:
belmo057
Date:
2022-05-19
Revision:
46:cf97e2ff152e
Parent:
45:ced6486325ab

File content as of revision 46:cf97e2ff152e:

#include <mbed.h>

#include "PM2_Libary.h"
#include "Eigen/Dense.h"
#include <cstdlib>
# define M_PI 3.14159265358979323846  // number pi

// workshop
InterruptIn user_button(PC_13);
void user_button_pressed();
Timer timer1;
DigitalOut led1(LED1);

int main()
{
    const int main_task_period_ms = 10;
    user_button.fall(&user_button_pressed);
    timer1.start();

    while (true) { // this loop will run forever

    }
}

void user_button_pressed()
{    
    int curTime = std::chrono::duration_cast<std::chrono::microseconds>(timer1.elapsed_time()).count();
    if(curTime > 2000)
    {
        led1 =! led1;
    }
    timer1.reset();
    timer1.start();

}