A library for interfacing with the Pixy color recognition camera

Dependents:   PixyCamera MbedOS_Robot_Team ManualControlFinal PlayBack ... more

Embed: (wiki syntax)

« Back to documentation index

PixySPI Class Reference

PixySPI Class Reference

The SPI Pixy interface for the Pixy camera. More...

#include <Pixy.h>

Inherits TPixy< PixyInterfaceSPI >.

Public Member Functions

 PixySPI (SPI *spi, Serial *serialOut=NULL, uint16_t arg=PIXY_DEFAULT_ARGVAL)
 Constructor for the PixySPI class Instantiates a Pixy object that communicates via an SPI connection.
void printBlock (Block &block)
 Prints the given Block out to the given serial port.
uint16_t getBlocks (uint16_t maxBlocks=1000)
 Returns the number of Blocks found in the current view and updates all Blocks' info.
int8_t setServos (uint16_t s0, uint16_t s1)
 Sets the PWM value of the Pixy servos.
int8_t setBrightness (uint8_t brightness)
 Sets the brightness of the Pixy RGB LED.
int8_t setLED (uint8_t r, uint8_t g, uint8_t b)
 Sets the color of the Pixy RGB LED.
void init ()
 Initializes the Pixy.

Detailed Description

The SPI Pixy interface for the Pixy camera.

 #include "Pixy.h"
 Serial serial(USBTX, USBRX);
 SPI spi(p5, p6, p7);
 PixySPI pixy(&spi, &serial);

 int main() {
     runPanTiltDemo();
 }

Definition at line 23 of file Pixy.h.


Constructor & Destructor Documentation

PixySPI ( SPI *  spi,
Serial *  serialOut = NULL,
uint16_t  arg = PIXY_DEFAULT_ARGVAL 
)

Constructor for the PixySPI class Instantiates a Pixy object that communicates via an SPI connection.

Parameters:
SPI*spi the pointer to the SPI connection
Serial*serialOut the optional serial output pointer to print out Pixy camera data
intarg an optional integer argument used for custom implementations of the Pixy library

Definition at line 32 of file Pixy.h.


Member Function Documentation

uint16_t getBlocks ( uint16_t  maxBlocks = 1000 ) [inherited]

Returns the number of Blocks found in the current view and updates all Blocks' info.

Parameters:
maxBlocksthe maximum number of Blocks to search for
Returns:
the number of Blocks found
void init (  ) [inherited]

Initializes the Pixy.

void printBlock ( Block block ) [inherited]

Prints the given Block out to the given serial port.

Parameters:
&blockthe Block to print
int8_t setBrightness ( uint8_t  brightness ) [inherited]

Sets the brightness of the Pixy RGB LED.

Parameters:
brightnessthe brightness of the LED
Returns:
the interface return value for sending the brightness command
int8_t setLED ( uint8_t  r,
uint8_t  g,
uint8_t  b 
) [inherited]

Sets the color of the Pixy RGB LED.

Parameters:
rthe red color value
gthe green color value
bthe blue color value
int8_t setServos ( uint16_t  s0,
uint16_t  s1 
) [inherited]

Sets the PWM value of the Pixy servos.

Parameters:
s0the value of the left servo
s1the value of the right servo
Returns:
the interface return value for sending the servo command