toujours pour mes débiles

Dependencies:   mbed pixy

Revision:
0:f0964760b5b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 27 12:05:35 2018 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "Pixy.h"
+#include "PixyLink.h"
+#define PERIOD 0.0001
+#define seuil_taille 3000 //seuil auquel le robot arrete d'avancer 
+#define K 0.2// coef erreur pour asservissement
+Serial pc(USBTX,USBRX);
+
+
+//variables globales
+
+float taille =0;
+
+//Programme principal
+uint16_t blocks;
+Pixy pixy = Pixy(p28,p27);
+int main()
+{
+    
+    int j=0;  
+    
+    pixy.setSerialOutput(&pc);
+    int errorX = 0, errorY = 0,block;
+    pc.printf("alive");
+    while(1) {
+
+        blocks = pixy.getBlocks();
+
+        if(blocks) 
+        {
+            
+            taille=pixy.blocks[j].width*pixy.blocks[j].height;
+            errorX = (160-pixy.blocks[j].x);
+            errorY = (100-pixy.blocks[j].y);
+            pc.printf("non sig: %d x: %d y: %d width: %d height: %d\n\r", pixy.blocks[j].signature, pixy.blocks[j].x, pixy.blocks[j].y, pixy.blocks[j].width, pixy.blocks[j].height);
+        }
+
+        
+    }
+}