Program utama test puxt cmucam5 di stm32f446re

Dependencies:   mbed

Fork of PIXY_KRPAI_ITB by Achmad Fathoni

Committer:
acracan
Date:
Sun Nov 16 11:54:19 2014 +0000
Revision:
0:63532ae95efe
Child:
1:97221820a967
Pixy hello world example.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
acracan 0:63532ae95efe 1 #include "mbed.h"
acracan 0:63532ae95efe 2 #include "Pixy.h"
acracan 0:63532ae95efe 3
acracan 0:63532ae95efe 4 Pixy pixy(Pixy::SPI, D11, D12, D13);
acracan 0:63532ae95efe 5 Serial pc(USBTX, USBRX);
acracan 0:63532ae95efe 6
acracan 0:63532ae95efe 7 int main() {
acracan 0:63532ae95efe 8 pixy.setSerialOutput(&pc);
acracan 0:63532ae95efe 9 while (1) {
acracan 0:63532ae95efe 10 static int i = 0;
acracan 0:63532ae95efe 11 int j;
acracan 0:63532ae95efe 12 uint16_t blocks;
acracan 0:63532ae95efe 13
acracan 0:63532ae95efe 14 blocks = pixy.getBlocks();
acracan 0:63532ae95efe 15
acracan 0:63532ae95efe 16 if (blocks) {
acracan 0:63532ae95efe 17 i++;
acracan 0:63532ae95efe 18
acracan 0:63532ae95efe 19 if (i % 50 == 0) {
acracan 0:63532ae95efe 20 pc.printf("Detected %d:\n\r", blocks);
acracan 0:63532ae95efe 21 for (j = 0; j < blocks; j++) {
acracan 0:63532ae95efe 22 pc.printf(" block %d: ", j);
acracan 0:63532ae95efe 23 pixy.blocks[j].print(pc);
acracan 0:63532ae95efe 24 }
acracan 0:63532ae95efe 25 }
acracan 0:63532ae95efe 26 }
acracan 0:63532ae95efe 27 }
acracan 0:63532ae95efe 28 }