A demo setup of the "Pan/Tilt Demo" code. This demo code uses the default setup of the Pixy servo motor control to follow Block 0 signature defined on the Pixy camera using the PixyMon software. Demo can be found here: https://www.youtube.com/watch?v=6D5IQyrFocU https://developer.mbed.org/users/swilkins8/notebook/cmucam5-pixy/

Dependencies:   mbed TPixy-Interface

Files at this revision

API Documentation at this revision

Comitter:
michelmoulin
Date:
Tue Nov 17 17:06:06 2020 +0000
Parent:
0:886deae63aa3
Commit message:
Ce pg affiche les coordonnees x et y du block detecte par la pixy

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 886deae63aa3 -r b05954fae6d8 main.cpp
--- a/main.cpp	Mon Mar 14 00:38:32 2016 +0000
+++ b/main.cpp	Tue Nov 17 17:06:06 2020 +0000
@@ -1,12 +1,25 @@
+
+/* 17/11/20 : Ce pg affiche les coordonnées x et y du block détecté par la pixy */
 #include "Pixy.h"
-//#include "TPixyInterface.h"
-//#include "TPixy.h"
 
 Serial serial(USBTX, USBRX);
-SPI spi(p5, p6, p7);
+SPI spi(PC_12, PC_11, PC_10); // mosi, miso, clk du SPI3
 PixySPI pixy(&spi, &serial);
 
 int main()
 {
-    runPanTiltDemo(&pixy, &serial);
+    uint16_t blocks;
+    serial.printf("debut....\n\r");
+    spi.frequency(1000000);
+    while(1) 
+    {
+        serial.printf("nouvel essai : ");
+        blocks = pixy.getBlocks();
+        if (blocks) 
+        {
+               serial.printf("Detected %d : ", blocks);
+               serial.printf("x=%d, y=%d \n\r",pixy.blocks[0].x,pixy.blocks[0].y);
+        }
+        wait(1);            
+    }
 }
\ No newline at end of file