Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@2:e443871f42f2, 2015-03-31 (annotated)
- Committer:
- GJ23
- Date:
- Tue Mar 31 13:00:34 2015 +0000
- Revision:
- 2:e443871f42f2
- Parent:
- 1:7f8b8f2bc12f
- Child:
- 3:013492d1db6d
SD; ;
Who changed what in which revision?
User | Revision | Line number | New 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 | 1:7f8b8f2bc12f | 5 | DigitalOut sortie1(A0); |
GJ23 | 1:7f8b8f2bc12f | 6 | DigitalOut sortie2(A1); |
GJ23 | 0:d42483d446b2 | 7 | |
GJ23 | 0:d42483d446b2 | 8 | int cran=0; |
GJ23 | 2:e443871f42f2 | 9 | sortie1 = 0; |
GJ23 | 2:e443871f42f2 | 10 | sortie2 = 0; |
GJ23 | 0:d42483d446b2 | 11 | |
GJ23 | 0:d42483d446b2 | 12 | void frontMontant1() |
GJ23 | 0:d42483d446b2 | 13 | { |
GJ23 | 0:d42483d446b2 | 14 | cran++; |
GJ23 | 2:e443871f42f2 | 15 | pc.printf("cran: %f \n\r",cran); |
GJ23 | 0:d42483d446b2 | 16 | } |
GJ23 | 0:d42483d446b2 | 17 | |
GJ23 | 1:7f8b8f2bc12f | 18 | void avancer(int distance_mm) |
GJ23 | 1:7f8b8f2bc12f | 19 | { |
GJ23 | 1:7f8b8f2bc12f | 20 | int nb_cran_max=(distance_mm/195)*16; |
GJ23 | 1:7f8b8f2bc12f | 21 | cran=0; |
GJ23 | 1:7f8b8f2bc12f | 22 | |
GJ23 | 1:7f8b8f2bc12f | 23 | while(cran<=nb_cran_max) |
GJ23 | 1:7f8b8f2bc12f | 24 | { |
GJ23 | 1:7f8b8f2bc12f | 25 | sortie1 = 1; |
GJ23 | 1:7f8b8f2bc12f | 26 | sortie2 = 0; |
GJ23 | 1:7f8b8f2bc12f | 27 | } |
GJ23 | 1:7f8b8f2bc12f | 28 | |
GJ23 | 2:e443871f42f2 | 29 | sortie1 = 0; |
GJ23 | 2:e443871f42f2 | 30 | sortie2 = 0; |
GJ23 | 1:7f8b8f2bc12f | 31 | } |
GJ23 | 1:7f8b8f2bc12f | 32 | |
GJ23 | 1:7f8b8f2bc12f | 33 | void main() |
GJ23 | 1:7f8b8f2bc12f | 34 | { |
GJ23 | 1:7f8b8f2bc12f | 35 | entree1.rise(&frontMontant1); |
GJ23 | 2:e443871f42f2 | 36 | pc.printf("Start \n\r"); |
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 |