COSA
An Object-Oriented Platform for Arduino Programming
TCS230 Class Reference

#include <TCS230.hh>

Collaboration diagram for TCS230:
Collaboration graph

Public Types

enum  Filter { RED_FILTER = 0, BLUE_FILTER = 1, NO_FILTER = 2, GREEN_FILTER = 3 }
 

Public Member Functions

 TCS230 (Board::ExternalInterruptPin out=Board::EXT1, Board::DigitalPin s0=Board::D4, Board::DigitalPin s1=Board::D5, Board::DigitalPin s2=Board::D6, Board::DigitalPin s3=Board::D7)
 
void frequency_scaling (uint8_t percent)
 
void photodiode (Filter type)
 
uint16_t sample (uint8_t ms=10)
 

Detailed Description

Cosa Device Driver for TCS230 Programmable Color Light-to-Frequency Converter.

Circuit

TCS230 Module
P1 +------------+ P2
(D4)---------------1-|S0 S3|-1-----------------(D7)
(D5)---------------2-|S1 S2|-2-----------------(D6)
3-|OE OUT|-3------------(D3/EXT1)
(GND)--------------4-|GND VCC|-4----------------(VCC)
+------------+

References

  1. TCS230 Programmable Color Light-to-Frequency Converter, TAOS046, Feb. 2003, http://www.pobot.org/IMG/pdf/tcs230_datasheet.pdf

Definition at line 46 of file TCS230.hh.

Member Enumeration Documentation

Photodiode type setting, S2 and S3. (Table 1. Selectable Options, pp. 2).

Enumerator
RED_FILTER 
BLUE_FILTER 
NO_FILTER 
GREEN_FILTER 

Definition at line 52 of file TCS230.hh.

Constructor & Destructor Documentation

Construct TCS230 device driver with given device output pin and selectable option, output frequency scaling and photodiode type, pins. The default setting is 20% scaling and GREEN.

Parameters
[in]outdevice data pulse output (default EXT1).
[in]s0frequency scaling option bit0 (default D4).
[in]s1frequency scaling option bit1 (default D5).
[in]s2photodiode type option bit0 (default D6).
[in]s3photodiode type option bit0 (default D7).

Definition at line 24 of file TCS230.cpp.

Member Function Documentation

void TCS230::frequency_scaling ( uint8_t  percent)

Set output frequency scaling (f0). Power-down (0%), 2%, 20% and 100% levels.

Parameters
[in]percentoutput frequency scaling.

Definition at line 45 of file TCS230.cpp.

void TCS230::photodiode ( Filter  type)

Set photodiode filter type (RED, GREEN, BLUE or NO_FILTER).

Parameters
[in]typeof color filter.

Definition at line 38 of file TCS230.cpp.

uint16_t TCS230::sample ( uint8_t  ms = 10)

Collect generated pulses for the given time-period with the current output frequency scaling and photodiode type. Return number of pulses or UINT16_MAX if over-flow.

Returns
pulses.

Definition at line 73 of file TCS230.cpp.


The documentation for this class was generated from the following files: