Hi Folks,
I am trying to use the Pixy with a Teensy3.1 using SPI and Slave Select. (I also have a TFT screen connected to the Pixy over SPI that I would like to use with a different SS pin).
I have the Pixy SS pin (pin 7 on the pixy header) wired to pin 3 on my Teensy.
When I have the “interface” setting in Pixymon set to “Arduino with SPI”, the data stream nicely.
When I change to “SPI with SS” I get nothing.
I am using the call
#include <PixySPI_SS.h>
and
PixySPI_SS pixy(pixy_SS);
where pixy_SS is defined as pin 3. See code below.
One interesting thing is I measured with a voltmeter and it seems like the pixy_SS pin is never driven low.
I appreciate all help!
/*
Pixy Camera over SPI:
It prints the detected blocks
TFT screen over SPI
*/
#include
#include
#include "ILI9341_t3.h"
// For the TFT screen
#define TFT_DC 21
#define TFT_CS 15
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
#define pixy_SS 3 //the Slave Select pin that pixy is on
// This is the main Pixy object
PixySPI_SS pixy(pixy_SS);
void setup()
{
Serial.begin(115200);
Serial.print("Starting...\n");
pinMode(pixy_SS,OUTPUT);
pinMode(TFT_CS,OUTPUT);
tft.begin();
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(2);
tft.println("Waiting for output...");
delay(1000);
pixy.init();
}
void loop()
{
static int i = 0;
int j;
uint16_t blocks;
char buf[32];
// grab blocks!
blocks = pixy.getBlocks();
// If there are detect blocks, print them!
if (blocks)
{
i++;
// do this (print) every 25 frames because printing every
// frame would bog down the Arduino
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();
}
}
}
//tft.fillScreen(ILI9341_BLACK);
//digitalWrite(TFT_CS,HIGH);
}
It looks correct.