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
Diff: source/main.cpp
- Revision:
- 0:3af30bfbc3e5
- Child:
- 1:49100fa5e278
diff -r 000000000000 -r 3af30bfbc3e5 source/main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/main.cpp Tue Jan 13 15:37:52 2015 +0000
@@ -0,0 +1,57 @@
+
+//Bibliothéque
+#include "mbed.h"
+#include "QEI.h"
+#include "Gestion_Moteur.h"
+#include "Camera.h"
+#include "Servo.h"
+
+//Differents objet/variable global
+
+
+
+Serial uart(PTD3, PTD2);
+Servo servo(PTD0);
+
+
+int main() {
+ // Initialisation
+
+ int indexMin=0;
+ int indexMax=128;
+ int max_detect=indexMin;
+ uart.baud(115200);
+ init_led();
+
+ // Init UART baudrate
+
+
+ // Lancement boucle
+ while(1){
+
+ readline();
+
+ passebas();
+
+ uart.printf("S");
+ for (int indice_pixel=0; indice_pixel<128; indice_pixel++)
+ {
+ uart.printf("%d,",pixel[indice_pixel]);
+ }
+ uart.printf("E");
+ //uart.printf("\n\r");
+
+ for (int j=indexMin; j<indexMax; j++)
+ {
+ if (pixel[j]>pixel[max_detect])
+ {
+ max_detect=j;
+ }
+ }
+
+ //servo = float(min_detect-indexMin)/float(indexMax-indexMin);
+ servo = float(max_detect)/128.;
+
+ }
+}
+