For Contest
Dependencies: BLE_API HCSR04 X_NUCLEO_IDB0XA1 mbed
Fork of contest_IOT6 by
Diff: display.h
- Revision:
- 7:fd3602c86d75
- Parent:
- 6:55319ed07a08
- Child:
- 8:8d6474336444
--- a/display.h Wed Nov 04 15:02:59 2015 +0000 +++ b/display.h Wed Nov 04 15:29:42 2015 +0000 @@ -100,4 +100,37 @@ } +int print_ball(Serial &pc, int *distance1, int *distance2, double *posBallX, double *posBallY){ + pc.printf("\033[%d;%dH",(int)*posBallY, (int)*posBallX); //Place le curseur à 0:0 + pc.printf(" "); //Place le curseur à 0:0 + if(*posBallY <= 50){ + if(*distance1 <= 10){ + *posBallX = 4; + } + else if(*distance1 >= 34){ + *posBallX = 27; + } + else{ + *posBallX = *distance1; + } + } + else + { + if(*distance2 <= 10){ + *posBallX = 4; + } + else if(*distance2 >= 34){ + *posBallX = 27; + } + else{ + *posBallX = *distance2; + } + } + pc.printf("\033[%d;%dH",(int)*posBallY, (int)*posBallX); //Place le curseur à 0:0 + pc.printf("o"); //Place le curseur à 0:0 + return 3; +} + + + #endif \ No newline at end of file