affichage v7
Fork of AFFICHAGE by
Affichage.cpp@8:80a4449820ac, 2017-03-15 (annotated)
- Committer:
- fab16
- Date:
- Wed Mar 15 15:26:50 2017 +0000
- Revision:
- 8:80a4449820ac
- Parent:
- 7:8cadfcb7809f
- Child:
- 9:2cc0e874fb4e
v6
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 | 8:80a4449820ac | 58 | |
fab16 | 6:82586f775dc5 | 59 | } |
fab16 | 6:82586f775dc5 | 60 | } |
fab16 | 8:80a4449820ac | 61 | |
fab16 | 8:80a4449820ac | 62 | void Affichage::afficherObstacle(bool obstacle){ |
fab16 | 8:80a4449820ac | 63 | |
fab16 | 8:80a4449820ac | 64 | m3piA.cls(); |
fab16 | 8:80a4449820ac | 65 | |
fab16 | 8:80a4449820ac | 66 | if(obstacle==true){ |
fab16 | 8:80a4449820ac | 67 | m3piA.printf("true"); |
fab16 | 8:80a4449820ac | 68 | wait(1); |
fab16 | 8:80a4449820ac | 69 | } |
fab16 | 8:80a4449820ac | 70 | else{ |
fab16 | 8:80a4449820ac | 71 | m3piA.printf("false"); |
fab16 | 8:80a4449820ac | 72 | wait(1); |
fab16 | 8:80a4449820ac | 73 | } |
fab16 | 8:80a4449820ac | 74 | |
fab16 | 8:80a4449820ac | 75 | } |
fab16 | 3:97cb6955fab2 | 76 |