Seek&Destroyers / Mbed 2 deprecated test_avance

Dependencies:   mbed

Committer:
GJ23
Date:
Tue Mar 31 14:09:58 2015 +0000
Revision:
4:a61068858bcf
Parent:
3:013492d1db6d
SD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GJ23 0:d42483d446b2 1 #include "mbed.h"
GJ23 0:d42483d446b2 2
GJ23 2:e443871f42f2 3 Serial pc(USBTX, USBRX);
GJ23 1:7f8b8f2bc12f 4 InterruptIn entree1(D9);
GJ23 4:a61068858bcf 5 PwmOut sortie1(A0);
GJ23 1:7f8b8f2bc12f 6 DigitalOut sortie2(A1);
GJ23 0:d42483d446b2 7
GJ23 0:d42483d446b2 8 int cran=0;
GJ23 0:d42483d446b2 9
GJ23 0:d42483d446b2 10 void frontMontant1()
GJ23 0:d42483d446b2 11 {
GJ23 3:013492d1db6d 12 cran=cran+1;
GJ23 2:e443871f42f2 13 pc.printf("cran: %f \n\r",cran);
GJ23 0:d42483d446b2 14 }
GJ23 0:d42483d446b2 15
GJ23 1:7f8b8f2bc12f 16 void avancer(int distance_mm)
GJ23 1:7f8b8f2bc12f 17 {
GJ23 1:7f8b8f2bc12f 18 int nb_cran_max=(distance_mm/195)*16;
GJ23 1:7f8b8f2bc12f 19 cran=0;
GJ23 1:7f8b8f2bc12f 20
GJ23 1:7f8b8f2bc12f 21 while(cran<=nb_cran_max)
GJ23 1:7f8b8f2bc12f 22 {
GJ23 4:a61068858bcf 23 sortie1 = 0.1;
GJ23 4:a61068858bcf 24 sortie2 = !sortie1;
GJ23 1:7f8b8f2bc12f 25 }
GJ23 1:7f8b8f2bc12f 26
GJ23 2:e443871f42f2 27 sortie1 = 0;
GJ23 2:e443871f42f2 28 sortie2 = 0;
GJ23 1:7f8b8f2bc12f 29 }
GJ23 1:7f8b8f2bc12f 30
GJ23 4:a61068858bcf 31 int main(void)
GJ23 1:7f8b8f2bc12f 32 {
GJ23 1:7f8b8f2bc12f 33 entree1.rise(&frontMontant1);
GJ23 2:e443871f42f2 34 pc.printf("Start \n\r");
GJ23 3:013492d1db6d 35 sortie1 = 0;
GJ23 3:013492d1db6d 36 sortie2 = 0;
GJ23 1:7f8b8f2bc12f 37 avancer(350);
GJ23 1:7f8b8f2bc12f 38 while(1)
GJ23 1:7f8b8f2bc12f 39 {
GJ23 1:7f8b8f2bc12f 40
GJ23 1:7f8b8f2bc12f 41 }
GJ23 1:7f8b8f2bc12f 42 }
GJ23 0:d42483d446b2 43