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

TPixy< TPixyInterface > Class Template Reference

TPixy< TPixyInterface > Class Template Reference

The superclass handler for the Pixy camera from a given connection handler (SPI, I2C, etc) Used for instantiating a Pixy object that interfaces via an abtritrary connection handler. More...

#include <TPixy.h>

Public Member Functions

 TPixy (TPixyInterface *type, Serial *serialOut=NULL, uint16_t arg=PIXY_DEFAULT_ARGVAL)
 Creates a TPixy object with a given connection handler.
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

template<class TPixyInterface>
class TPixy< TPixyInterface >

The superclass handler for the Pixy camera from a given connection handler (SPI, I2C, etc) Used for instantiating a Pixy object that interfaces via an abtritrary connection handler.

Definition at line 71 of file TPixy.h.


Constructor & Destructor Documentation

TPixy ( TPixyInterface type,
Serial *  serialOut = NULL,
uint16_t  arg = PIXY_DEFAULT_ARGVAL 
)

Creates a TPixy object with a given connection handler.

Parameters:
typethe pointer to the interface connection handler
serialOutthe optional serial output pointer to print out Pixy camera data
argan optional integer argument used for custom implementations of the Pixy library

Definition at line 135 of file TPixy.h.


Member Function Documentation

uint16_t getBlocks ( uint16_t  maxBlocks = 1000 )

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

Definition at line 204 of file TPixy.h.

void init (  )

Initializes the Pixy.

Definition at line 129 of file TPixy.h.

void printBlock ( Block block )

Prints the given Block out to the given serial port.

Parameters:
&blockthe Block to print

Definition at line 144 of file TPixy.h.

int8_t setBrightness ( uint8_t  brightness )

Sets the brightness of the Pixy RGB LED.

Parameters:
brightnessthe brightness of the LED
Returns:
the interface return value for sending the brightness command

Definition at line 277 of file TPixy.h.

int8_t setLED ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Sets the color of the Pixy RGB LED.

Parameters:
rthe red color value
gthe green color value
bthe blue color value

Definition at line 286 of file TPixy.h.

int8_t setServos ( uint16_t  s0,
uint16_t  s1 
)

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

Definition at line 267 of file TPixy.h.