Test

Dependencies:   mbed DRV8825

captUS.cpp

Committer:
Nanaud
Date:
2020-07-08
Revision:
1:2fe8c402ee79
Parent:
0:dc036b67c87c
Child:
15:43f5bda97488
Child:
20:7d206773f39e

File content as of revision 1:2fe8c402ee79:

//Nom du fichier : captUS.cpp
#include "pins.h"

// Variables globales & timers
float us_out[6];
Timer tps;
Ticker ticker_US;

void captUS_init(){
    tps.start();}

void captUS_trig(){
    tps.reset();
    trigger=1;
    wait(0.00002);
    trigger=0;
}

void echoRise1(){us_out[0]=tps.read_us();}
void echoFall1(){us_out[0]=(tps.read_us()-us_out[0])/2;}

void echoRise2(){us_out[1]=tps.read_us();}
void echoFall2(){us_out[1]=(tps.read_us()-us_out[1])/2;}

void echoRise3(){us_out[2]=tps.read_us();}
void echoFall3(){us_out[2]=(tps.read_us()-us_out[2])/2;}

void echoRise4(){us_out[3]=tps.read_us();}
void echoFall4(){us_out[3]=(tps.read_us()-us_out[3])/2;}

void echoRise5(){us_out[4]=tps.read_us();}
void echoFall5(){us_out[4]=(tps.read_us()-us_out[4])/2;}

void echoRise6(){us_out[5]=tps.read_us();}
void echoFall6(){us_out[5]=(tps.read_us()-us_out[5])/2;}