Test

Dependencies:   mbed DRV8825

main.cpp

Committer:
Nanaud
Date:
2020-07-18
Revision:
4:ad9b7355332e
Parent:
3:3ba377aafdfd
Child:
6:ea6b30c4bb01

File content as of revision 4:ad9b7355332e:

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

int main()
{
    pc.printf("\r\nAresCDFMainCode\r\n");
    bt.printf("\r\nAresCDFMainCode\r\n");

    // debug
    pc.attach(&serialIT); // Interruption liaison série
    bt.attach(&bluetoothIT); // Interruption  bluetooth

    // Init capteurs à ultrasons
    captUS_init();
    echo1.rise(&echoRise1);
    echo1.fall(&echoFall1);
    echo2.rise(&echoRise2);
    echo2.fall(&echoFall2);
    echo3.rise(&echoRise3);
    echo3.fall(&echoFall3);
    echo4.rise(&echoRise4);
    echo4.fall(&echoFall4);
    echo5.rise(&echoRise5);
    echo5.fall(&echoFall5);
    echo6.rise(&echoRise6);
    echo6.fall(&echoFall6);

    // Init DRV8825
    drv_init();

    // Init codeurs
    cdgA.rise(&cdgaRise);
    //cdgB.rise(&cdgbRise);
    cdgA.mode(PullUp);
    cdgB.mode(PullUp);

    // Fonctions d'affichage pour les tests
    ticker_US.attach(&captUS_trig,0.2); // On apelle cette fonction toutes 0.2 secondes
    ticker_affUS.attach(&affUltrasons,1.0);
    ticker_affcd.attach(&affCodeurs,1.0);
    //aff_cd[0]=!aff_cd[0];

    //test_drv();

    pc.baud(9600);
    pc.format(8,SerialBase::None,1);
    bt.baud(9600);
    bt.format(8,SerialBase::None,1);

    while(1) {}
}