<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:arduino_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
wiki:v2:arduino_api [2018/05/28 01:44]
pixycam
wiki:v2:arduino_api [2020/01/28 03:55]
jfrench
Line 8: Line 8:
 ===== Installing the Arduino Library ===== ===== Installing the Arduino Library =====
  
-Download the latest Arduino library "​arduino%%_%%pixy-x.y.z.zip"​ [[https://​pixycam.com/​downloads-pixy2/​|here]]. Bring up the Arduino IDE and import the Pixy library by selecting **Sketch➜Import Library** in the Arduino IDE, and then browse to the Arduino zip file that you just downloaded.+Download the latest Arduino library "​arduino%%_%%pixy2-x.y.z.zip"​ [[https://​pixycam.com/​downloads-pixy2/​|here]]. Bring up the Arduino IDE and import the Pixy library by selecting **Sketch➜Import Library** in the Arduino IDE, and then browse to the Arduino zip file that you just downloaded.
  
  
Line 38: Line 38:
 ==== uint16_t getBlocks(uint16_t maxBlocks=1000) ==== ==== uint16_t getBlocks(uint16_t maxBlocks=1000) ====
  
-The most important method in the Arduino library is ''​%%getBlocks()%%'',​ which returns the number of objects Pixy has detected. You can then look in the ''​%%pixy.blocks[]%%''​ array for information about each detected object (one array member for each detected object.) Each array member (''​%%i%%''​) contains the following fields:+The most important method in the Arduino library is ''​%%getBlocks()%%'',​ which returns the number of objects Pixy has detected. You can then look in the ''​%%pixy.ccc.blocks[]%%''​ array for information about each detected object (one array member for each detected object.) Each array member (''​%%i%%''​) contains the following fields:
  
-  * ''​%%pixy.blocks[i].signature%%''​ The signature number of the detected object (1-7 for normal signatures) +  * ''​%%pixy.ccc.blocks[i].m_signature%%''​ The signature number of the detected object (1-7 for normal signatures) 
-  * ''​%%pixy.blocks[i].x%%''​ The x location of the center of the detected object (0 to 319+  * ''​%%pixy.ccc.blocks[i].m_x%%''​ The x location of the center of the detected object (0 to 316
-  * ''​%%pixy.blocks[i].y%%''​ The y location of the center of the detected object (0 to 199+  * ''​%%pixy.ccc.blocks[i].m_y%%''​ The y location of the center of the detected object (0 to 208
-  * ''​%%pixy.blocks[i].width%%''​ The width of the detected object (1 to 320+  * ''​%%pixy.ccc.blocks[i].m_width%%''​ The width of the detected object (1 to 316
-  * ''​%%pixy.blocks[i].height%%''​ The height of the detected object (1 to 200+  * ''​%%pixy.ccc.blocks[i].m_height%%''​ The height of the detected object (1 to 208
-  * ''​%%pixy.blocks[i].angle%%''​ The angle of the object detected object if the detected object is a [[wiki:​v2:​Using_Color_Codes|color code]]. +  * ''​%%pixy.ccc.blocks[i].m_angle%%''​ The angle of the object detected object if the detected object is a [[wiki:​v2:​Using_Color_Codes|color code]] ​(-180 to 180)
-  * ''​%%pixy.blocks[i].print()%%''​ A member function that prints the detected object information to the serial port+  * ''​%%pixy.ccc.blocks[i].m_index%%''​ The [[wiki:​v2:​color_connected_components#​Pixy2 "​tracks"​ each object it detects|tracking index]] of the block 
 +  * ''​%%pixy.ccc.blocks[i].m_age%%''​ The number of frames the block has been tracked. 
 +  * ''​%%pixy.ccc.blocks[i].print()%%''​ A member function that prints the detected object information to the serial port
  
 ''​%%getBlocks()%%''​ accepts an optional number argument (''​%%uint16_t%%''​) that indicates the maximum number of blocks you want ''​%%getBlocks()%%''​ to return. ''​%%getBlocks()%%''​ accepts an optional number argument (''​%%uint16_t%%''​) that indicates the maximum number of blocks you want ''​%%getBlocks()%%''​ to return.
wiki/v2/arduino_api.txt · Last modified: 2020/01/28 03:56 by jfrench