affichage v7
Fork of AFFICHAGE by
Affichage.cpp@7:8cadfcb7809f, 2017-03-02 (annotated)
- Committer:
- fab16
- Date:
- Thu Mar 02 12:31:33 2017 +0000
- Revision:
- 7:8cadfcb7809f
- Parent:
- 6:82586f775dc5
- Child:
- 8:80a4449820ac
affichage v5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fab16 | 4:7c1e87f81b55 | 1 | #include "Affichage.h" |
fab16 | 4:7c1e87f81b55 | 2 | |
fab16 | 2:9a0f0587d296 | 3 | |
fab16 | 4:7c1e87f81b55 | 4 | |
fab16 | 4:7c1e87f81b55 | 5 | m3pi m3piA; |
fab16 | 2:9a0f0587d296 | 6 | |
fab16 | 2:9a0f0587d296 | 7 | void Affichage::bonjour(){ |
fab16 | 3:97cb6955fab2 | 8 | m3piA.cls(); |
fab16 | 3:97cb6955fab2 | 9 | m3piA.print("Bonjour",7); |
fab16 | 3:97cb6955fab2 | 10 | wait(1); |
fab16 | 2:9a0f0587d296 | 11 | } |
fab16 | 2:9a0f0587d296 | 12 | |
fab16 | 4:7c1e87f81b55 | 13 | void Affichage::afficheResult(float result){ |
fab16 | 4:7c1e87f81b55 | 14 | m3piA.cls(); |
fab16 | 4:7c1e87f81b55 | 15 | m3piA.printf("%f",result); |
fab16 | 4:7c1e87f81b55 | 16 | wait(1); |
fab16 | 4:7c1e87f81b55 | 17 | } |
fab16 | 2:9a0f0587d296 | 18 | |
fab16 | 4:7c1e87f81b55 | 19 | |
fab16 | 4:7c1e87f81b55 | 20 | // affichage de 8 caractere max |
fab16 | 4:7c1e87f81b55 | 21 | void Affichage::affichageCourt(char*message){ |
fab16 | 4:7c1e87f81b55 | 22 | m3piA.cls(); |
fab16 | 4:7c1e87f81b55 | 23 | m3piA.print(message,strlen(message)); |
fab16 | 5:6834f15a1e48 | 24 | wait(1); |
fab16 | 5:6834f15a1e48 | 25 | } |
fab16 | 5:6834f15a1e48 | 26 | |
fab16 | 5:6834f15a1e48 | 27 | |
fab16 | 5:6834f15a1e48 | 28 | |
fab16 | 5:6834f15a1e48 | 29 | void Affichage::effacerTout(){ |
fab16 | 5:6834f15a1e48 | 30 | m3piA.cls(); |
fab16 | 5:6834f15a1e48 | 31 | } |
fab16 | 5:6834f15a1e48 | 32 | |
fab16 | 5:6834f15a1e48 | 33 | // teste affichage sur 2 ligne |
fab16 | 5:6834f15a1e48 | 34 | void Affichage::affichage2ligne(){ |
fab16 | 5:6834f15a1e48 | 35 | m3piA.cls(); |
fab16 | 5:6834f15a1e48 | 36 | m3piA.locate(0,0); |
fab16 | 5:6834f15a1e48 | 37 | m3piA.print("a",1); |
fab16 | 5:6834f15a1e48 | 38 | m3piA.locate(0,1); |
fab16 | 5:6834f15a1e48 | 39 | m3piA.print("b",1); |
fab16 | 3:97cb6955fab2 | 40 | } |
fab16 | 6:82586f775dc5 | 41 | |
fab16 | 6:82586f775dc5 | 42 | void Affichage::affichageUltrason(float distance){ |
fab16 | 6:82586f775dc5 | 43 | m3piA.cls(); |
fab16 | 6:82586f775dc5 | 44 | |
fab16 | 7:8cadfcb7809f | 45 | if(distance >= 250){ |
fab16 | 6:82586f775dc5 | 46 | m3piA.print(" Rien ",8); |
fab16 | 6:82586f775dc5 | 47 | m3piA.locate(0,1); |
fab16 | 6:82586f775dc5 | 48 | m3piA.print(" en vue ",8); |
fab16 | 6:82586f775dc5 | 49 | wait(1); |
fab16 | 6:82586f775dc5 | 50 | } |
fab16 | 6:82586f775dc5 | 51 | |
fab16 | 6:82586f775dc5 | 52 | else{ |
fab16 | 6:82586f775dc5 | 53 | m3piA.locate(0,0); |
fab16 | 6:82586f775dc5 | 54 | m3piA.printf("Obstacle"); |
fab16 | 6:82586f775dc5 | 55 | m3piA.locate(0,1); |
fab16 | 6:82586f775dc5 | 56 | m3piA.printf(" %.1f cm",distance); |
fab16 | 6:82586f775dc5 | 57 | wait(1); |
fab16 | 6:82586f775dc5 | 58 | } |
fab16 | 6:82586f775dc5 | 59 | } |
fab16 | 3:97cb6955fab2 | 60 |