Alexandre Pirotte
/
pixy-Uart
toujours pour mes débiles
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "Pixy.h" 00003 #include "PixyLink.h" 00004 #define PERIOD 0.0001 00005 #define seuil_taille 3000 //seuil auquel le robot arrete d'avancer 00006 #define K 0.2// coef erreur pour asservissement 00007 Serial pc(USBTX,USBRX); 00008 00009 00010 //variables globales 00011 00012 float taille =0; 00013 00014 //Programme principal 00015 uint16_t blocks; 00016 Pixy pixy = Pixy(p28,p27); 00017 int main() 00018 { 00019 00020 int j=0; 00021 00022 pixy.setSerialOutput(&pc); 00023 int errorX = 0, errorY = 0,block; 00024 pc.printf("alive"); 00025 while(1) { 00026 00027 blocks = pixy.getBlocks(); 00028 00029 if(blocks) 00030 { 00031 00032 taille=pixy.blocks[j].width*pixy.blocks[j].height; 00033 errorX = (160-pixy.blocks[j].x); 00034 errorY = (100-pixy.blocks[j].y); 00035 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); 00036 } 00037 00038 00039 } 00040 }
Generated on Fri Jul 22 2022 05:32:28 by 1.7.2