Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <PixyI2C.h>
- PixyI2C pixy;
- void setup()
- {
- Wire.begin();
- Serial.begin(9600);
- Serial.print("Starting...\n");
- }
- void loop()
- {
- static int i = 0;
- int j;
- uint16_t blocks;
- char buf[32];
- blocks = pixy.getBlocks();
- if (blocks)
- {
- i++;
- if (i%50==0)
- {
- sprintf(buf, "Detected %d:\n", blocks);
- Serial.print(buf);
- for (j=0; j<blocks; j++)
- {
- sprintf(buf, " block %d: ", j);
- Serial.print(buf);
- pixy.blocks[j].print();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment