Raw Serial IO [SOLVED]
JonnyMac
Posts: 9,102
I have essential coms working for the Pixy2 camera in Spin -- I would like to translate that the BlocklyProp for Ken. I cannot seem to find a mechansim for sending and receiving raw bytes; everything in BlocklyProp is treated as formatted text (which is great for terminals, but doesn't work for the Pixy).
Am I missing something?
Am I missing something?
Comments
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide
...to my BlocklyProp code.
Here's how we ask the Pixy2 for its version information.
After any request, we can get the variable-length response with this code. Blockly doesn't have a lot of serial tools, and receiving blocks the program (so check your wires). Luckily, the Pixy2 header contains the number of bytes that come after the header, so we can use that information to determine how many bytes to wait for.
Once we've made a request and received the response, we can pull data from the packet.
Many of the values returned are 16 bits, so we need a little function to extract and build those values.
Keep in mind that his is early code and will likely see many changes.
-- http://blockly.parallax.com/blockly/projectlink?id=125427&key=aa367b94-ef76-41e0-9f4c-b497523cc406