Alexandre Pirotte
/
pixy-Uart
toujours pour mes débiles
Revision 0:f0964760b5b2, committed 2018-03-27
- Comitter:
- pirottealex
- Date:
- Tue Mar 27 12:05:35 2018 +0000
- Commit message:
- pour les teb? de 1?re ann?e;
Changed in this revision
diff -r 000000000000 -r f0964760b5b2 main.cpp --- /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); + } + + + } +}
diff -r 000000000000 -r f0964760b5b2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Mar 27 12:05:35 2018 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/794e51388b66 \ No newline at end of file
diff -r 000000000000 -r f0964760b5b2 pixy.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pixy.lib Tue Mar 27 12:05:35 2018 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/pirottealex/code/pixy/#e7cb59aaf759