<< return to Pixycam.com

What serial data to send request?

Using a PICAXE 28X2 chip I need to know what serial data I need to send to the PIXY2 so that the PIXY2 sends back;

x,y position of color and color ID

x,y position of a line and line color ID

barcode ID

Hex, or decimal doesn’t matter, I just need to know what the commands are to send to the PIXY2 to perform simple tasks and respond with data relative to those tasks.

Hello,
Please check out this page:
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide#line-tracking-packet-reference

You can also look at the source code here for implementation and additional reference:

Edward

Hi,

Out of all that c code I don’t see how I can create a serial out from my PIC chip to request specific color ID and x,y position?

I don’t see how I can create a serial out from my PIC chip to request x,y line position?

What are the HEX or Decimal commands to request all the various useable functions of the PIXY2 camera?

I’ve been looking at that page and other wiki/doc pages, but I don’t see a simple list of commands (HEX/Dec) v. responses (HEX/Dec)

It’s mostly here. It lays out the bytes in each packet explicitly.

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide#line-tracking-packet-reference

Hope this helps

Edward

Hi,

How much time do I have to wait for the response after sending the “serout C.1,B9600_8,(174,193)” command before looking for a response?

Hello,
If you just sent 174 and 193, you would not get a response because it wouldn’t be a complete packet.-- those are just the sync bytes.

If you send a packet, the response will come in less than 20ms.

Edward

Hi,

In the wiki on page: https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide#line-tracking-packet-reference

getBlocks(sigmap, maxBlocks)

Request:

|Bit|Description|Value(s)|
| | | |
|0 - 1| 16-bit sync | 174, 193 (0xc1ae) |
| 2 | Type of packet | 32 |
| 3 | Length of payload | 2 |
| 4 |Sigmap - indicate which signatures to receive data from| 0 (none) - 255 (all) |
| 5 | Maximum blocks to return | 0 (none) - 255 (all blocks) |

Response:

Byte Description Value(s)
0 - 1 16-bit sync 175, 193 (0xc1af)
2 Type of packet 33
3 Length of payload 14
4 - 5 16-bit checksum sum of payload bytes
6 - 7 16-bit signature / Color code number 0 - 255
8 - 9 16-bit X (center) of block in pixels 0 - 315
10 - 11 16-bit Y (center) of block in pixels 0 - 207
12 - 13 16-bit Width of block in pixels 0 - 316
14 - 15 16-bit Height of block in pixels 0 - 208
16 - 17 16-bit Angle of color-code in degrees -180 - 180 (0 if not a color code)
18 Tracking index of block (see API for more info) 0 - 255
19 Age - number of frames this block has been tracked 0 - 255 (stops incrementing at 255)

I’m not sure what the question is.