NIT Fukui / Mbed OS 2021Arobo_YUMIPYOI

Dependencies:   Serial6050Yaw CERICA_2019

Utility.h

Committer:
konagi
Date:
2022-04-25
Revision:
0:dfbe64c7cd06

File content as of revision 0:dfbe64c7cd06:

#pragma once

#define PI 3.1415926535897932384626433832795
#define pin GPIO[9]
RawSerial pc(USBTX,USBRX,115200);
//Serial6050 mpu(PC_10, PC_11, PC_12);
DigitalIn limit_pin = GPIO[0];
PwmOut PWM(PA_8);
DigitalOut debugLED(D13);
DigitalIn button(PC_13);

volatile int Opflag=0;
volatile int Clflag=0;
volatile int count=3;
volatile int Motor[4] = {0};
volatile double dire = 1;
volatile char  MoveFlag = 0;


void LEDThread()
{
    while(1){
        if(MoveFlag != 0){
            debugLED = 1;
            wait_ms(100);
            debugLED = 0;
        }
        else debugLED = 0;
    }
}

void commArduinoThread()
{
    while(1){
        cerica.Send(1);//MotorSend
        char flag[1];
        i2c.read(0x08 << 1,flag,1);

        MoveFlag = flag[0];
        //pc.printf("data : %u\r\n",flag[0]);
        wait_ms(40);
    }
}