Seek&Destroyers / Mbed 2 deprecated test_avance

Dependencies:   mbed

main.cpp

Committer:
GJ23
Date:
2015-03-31
Revision:
2:e443871f42f2
Parent:
1:7f8b8f2bc12f
Child:
3:013492d1db6d

File content as of revision 2:e443871f42f2:

#include "mbed.h"

Serial pc(USBTX, USBRX);
InterruptIn entree1(D9);
DigitalOut sortie1(A0);
DigitalOut sortie2(A1);

int cran=0;
sortie1 = 0;  
sortie2 = 0;  

void frontMontant1()
{
    cran++;
    pc.printf("cran: %f \n\r",cran);
}

void avancer(int distance_mm)
{
    int nb_cran_max=(distance_mm/195)*16;
    cran=0;
        
    while(cran<=nb_cran_max)
    {
     sortie1 = 1;  
     sortie2 = 0; 
    }
    
    sortie1 = 0;  
    sortie2 = 0;   
}

void main()
{
    entree1.rise(&frontMontant1);
    pc.printf("Start \n\r");
    avancer(350);
    while(1)
    {
        
    } 
}