tp5 er
Dependencies: mbed TPixy-Interface
Revision 0:c764fd85a659, committed 2019-12-03
- Comitter:
- PC2ROBOT
- Date:
- Tue Dec 03 13:49:16 2019 +0000
- Commit message:
- TP5
Changed in this revision
diff -r 000000000000 -r c764fd85a659 TPixy-Interface.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TPixy-Interface.lib Tue Dec 03 13:49:16 2019 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/swilkins8/code/TPixy-Interface/#66df7d295245
diff -r 000000000000 -r c764fd85a659 main_pixy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main_pixy.cpp Tue Dec 03 13:49:16 2019 +0000 @@ -0,0 +1,27 @@ +#include "Pixy.h" +//#include "TPixyInterface.h" +//#include "TPixy.h" + +Serial serial(USBTX, USBRX); //Déclaration d'une interface série +SPI spi(PA_7, PA_6, PA_5); //Déclaration d'une interface spi +PixySPI pixy(&spi, &serial); //Déclaration d'une interface pixy + +int main() +{ + uint16_t Block1; //Variable exprimant le nombre de balles dans le champ + pixy.init(); //Démarrage de la caméra pixy + while(1) + { + Block1 = pixy.getBlocks(); //Aquisition du nombre de Balles + if(Block1==1) + { + //Affichage de la position et de la taille + serial.printf("position : x = %d, y = %d Taille : %d \r\n", pixy.blocks[0].x, pixy.blocks[0].y, (pixy.blocks[0].width + pixy.blocks[0].height) / 2); + } + else + { + serial.printf("Il y a pas de balle.\n\r"); + } + wait(1); //Attente d'une seconde + } +} \ No newline at end of file
diff -r 000000000000 -r c764fd85a659 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 03 13:49:16 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file