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 freescal_cup_k22f
source/main.cpp@28:c9d882501013, 2015-01-21 (annotated)
- Committer:
- RobinN7
- Date:
- Wed Jan 21 18:19:56 2015 +0000
- Revision:
- 28:c9d882501013
- Parent:
- 27:d1da489fc79a
- Child:
- 29:e7f37f801c93
bite
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RobinN7 | 0:3af30bfbc3e5 | 1 | |
| RobinN7 | 0:3af30bfbc3e5 | 2 | //Bibliothéque |
| RobinN7 | 0:3af30bfbc3e5 | 3 | #include "mbed.h" |
| RobinN7 | 0:3af30bfbc3e5 | 4 | #include "QEI.h" |
| RobinN7 | 0:3af30bfbc3e5 | 5 | #include "Gestion_Moteur.h" |
| RobinN7 | 0:3af30bfbc3e5 | 6 | #include "Camera.h" |
| RobinN7 | 0:3af30bfbc3e5 | 7 | #include "Servo.h" |
| RobinN7 | 0:3af30bfbc3e5 | 8 | |
| RobinN7 | 27:d1da489fc79a | 9 | |
| RobinN7 | 0:3af30bfbc3e5 | 10 | //Differents objet/variable global |
| RobinN7 | 0:3af30bfbc3e5 | 11 | |
| RobinN7 | 27:d1da489fc79a | 12 | //Xbee |
| RobinN7 | 27:d1da489fc79a | 13 | Serial uart(PTD3, PTD2); |
| RobinN7 | 27:d1da489fc79a | 14 | |
| AlexandreN7 | 1:49100fa5e278 | 15 | //test de commit |
| RobinN7 | 14:000be67805b2 | 16 | //Serial uart(USBTX, USBRX); //port série usb ACM0 |
| RobinN7 | 26:a836e62e0c98 | 17 | |
| AlexandreN7 | 9:43c8e6d6724d | 18 | AnalogIn pot1(PTC1); |
| RobinN7 | 0:3af30bfbc3e5 | 19 | |
| RobinN7 | 0:3af30bfbc3e5 | 20 | int main() { |
| RobinN7 | 0:3af30bfbc3e5 | 21 | // Initialisation |
| RobinN7 | 0:3af30bfbc3e5 | 22 | |
| RobinN7 | 26:a836e62e0c98 | 23 | //float Kp_servo = 0; |
| RobinN7 | 0:3af30bfbc3e5 | 24 | init_led(); |
| RobinN7 | 26:a836e62e0c98 | 25 | init_camera(); |
| RobinN7 | 0:3af30bfbc3e5 | 26 | |
| RobinN7 | 27:d1da489fc79a | 27 | int compteur_uart=0; |
| RobinN7 | 27:d1da489fc79a | 28 | |
| RobinN7 | 0:3af30bfbc3e5 | 29 | // Init UART baudrate |
| RobinN7 | 27:d1da489fc79a | 30 | uart.baud(115200); |
| RobinN7 | 0:3af30bfbc3e5 | 31 | |
| RobinN7 | 0:3af30bfbc3e5 | 32 | |
| RobinN7 | 0:3af30bfbc3e5 | 33 | // Lancement boucle |
| RobinN7 | 0:3af30bfbc3e5 | 34 | while(1){ |
| RobinN7 | 26:a836e62e0c98 | 35 | |
| RobinN7 | 27:d1da489fc79a | 36 | if (flag_new_image==1) |
| RobinN7 | 27:d1da489fc79a | 37 | { |
| RobinN7 | 28:c9d882501013 | 38 | // uart.printf("0,%d,%d\n\r",max_detect1,max_detect2); |
| RobinN7 | 27:d1da489fc79a | 39 | if (compteur_uart ==20) // on envoit une trame toute les 50 acquisitions de cameras |
| RobinN7 | 26:a836e62e0c98 | 40 | { |
| RobinN7 | 28:c9d882501013 | 41 | uart.printf("S3");//debug START |
| RobinN7 | 28:c9d882501013 | 42 | uart.printf("%d,%d,%d,%lf,",max_detect1,max_detect2,0,ordre_servo); |
| RobinN7 | 28:c9d882501013 | 43 | uart.printf("E");//debug END |
| RobinN7 | 26:a836e62e0c98 | 44 | uart.printf("S1");//debug START |
| RobinN7 | 27:d1da489fc79a | 45 | for (int indice_pixel=0; indice_pixel<128; indice_pixel++) |
| RobinN7 | 26:a836e62e0c98 | 46 | { |
| RobinN7 | 26:a836e62e0c98 | 47 | uart.printf("%d,",pixel1[indice_pixel]); |
| RobinN7 | 26:a836e62e0c98 | 48 | } |
| RobinN7 | 26:a836e62e0c98 | 49 | uart.printf("E");//debug END |
| RobinN7 | 27:d1da489fc79a | 50 | |
| RobinN7 | 26:a836e62e0c98 | 51 | uart.printf("S2");//debug START |
| RobinN7 | 27:d1da489fc79a | 52 | for (int indice_pixel=0; indice_pixel<128; indice_pixel++) |
| RobinN7 | 26:a836e62e0c98 | 53 | { |
| RobinN7 | 26:a836e62e0c98 | 54 | uart.printf("%d,",pixel2[indice_pixel]); |
| RobinN7 | 26:a836e62e0c98 | 55 | } |
| RobinN7 | 26:a836e62e0c98 | 56 | uart.printf("E");//debug END |
| RobinN7 | 26:a836e62e0c98 | 57 | compteur_uart =0; |
| AlexandreN7 | 20:24ebe046ebe9 | 58 | } |
| RobinN7 | 27:d1da489fc79a | 59 | else |
| RobinN7 | 27:d1da489fc79a | 60 | { |
| RobinN7 | 26:a836e62e0c98 | 61 | compteur_uart =compteur_uart+1; |
| RobinN7 | 27:d1da489fc79a | 62 | } |
| AlexandreN7 | 20:24ebe046ebe9 | 63 | } |
| RobinN7 | 28:c9d882501013 | 64 | |
| RobinN7 | 27:d1da489fc79a | 65 | flag_new_image=0; |
| RobinN7 | 27:d1da489fc79a | 66 | |
| RobinN7 | 0:3af30bfbc3e5 | 67 | } |
| RobinN7 | 0:3af30bfbc3e5 | 68 | } |
| RobinN7 | 0:3af30bfbc3e5 | 69 |