mech / Mbed OS Shiken_3

function.h

Committer:
NSugiura
Date:
2018-12-19
Revision:
7:de699a50fc63
Parent:
4:45b45e8ca173

File content as of revision 7:de699a50fc63:

#include "mbed.h"

///////////////////////////////////////
int led_count1 = 0;//led用のカウンタ
int led_count2 = 0;//led用のカウンタ
int count1 = 0;//フィードバック用のカウンタ
int count2 = 0;//フィードバック用のカウンタ
int distance1 = 0;//右タイヤ
int distance2 = 0;//左タイヤ
int distance = 0;//平均
int c = 0;// 1秒ごとの回転数
int c1 = 0;//右の回転数
int c2 = 0;//左の回転数


Ticker flipper;

void flip1() {
    led_count1++;
    count1++;
    distance1++;
}

void flip2() {
    led_count2++;
    count2++;
    distance2++;
}

/*void flip3(){
    c =  20*( count1 + count2 ) / 2;//cは1秒ごとのパルス数
    c1 = 20*count1;
    c2 = 20*count2;
    
    count1 = 0;
    count2 = 0;
    }
*/

/*
class Sample{
    private:
        count;
    public:
        Sample();
        void counter();
        void counter2(int &num);
};

Sample::Sample()
{
    count=0;
}

void Sample::counter()
{
    count++;
}

void Sample::counter2(int& num)
{
    num+=1;
}

*/