Difference between revisions of "Component: Colour Sensor (TCS3200) (Light)"
From Flowcode Help
Jump to navigationJump to search| (9 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
==Component Source Code==  | ==Component Source Code==  | ||
| − | Please click here   | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Colour_TCS3200.fcfx FC_Comp_Source_Colour_TCS3200.fcfx]  | 
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Colour_TCS3200.fcfx FC_Comp_Source_Colour_TCS3200.fcfx]  | ||
==Detailed description==  | ==Detailed description==  | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| Line 30: | Line 44: | ||
==Examples==  | ==Examples==  | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| Line 41: | Line 67: | ||
| − | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==Macro reference==  | ||
| + | |||
| + | ===GetFrequency===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetFrequency'''  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Samples and returns the sensor output frequency (Hz)   | 
|-  | |-  | ||
|-  | |-  | ||
| − | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT  | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-  | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return''  | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
|}  | |}  | ||
| + | ===Initialise===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Initialise the sensor configuration as set by the component properties   | 
|-  | |-  | ||
|-  | |-  | ||
| Line 74: | Line 107: | ||
| + | ===SetConfig===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetConfig'''  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Sends the config data byte to the sensor using clock and data pins   | 
|-  | |-  | ||
|-  | |-  | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| − | | width="90%" |   | + | | width="90%" | Data  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" |    | 
|-  | |-  | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| Line 92: | Line 126: | ||
| + | ===SetFilter===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetFilter'''  | 
| + | |-  | ||
| + | | colspan="2" | Dynamically change the sensor filter to RGB or W. Red = 0 Green = 1 Blue = 2 White = 3   | ||
| + | |-  | ||
|-  | |-  | ||
| − | |   | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | 
| + | | width="90%" | FilterColour  | ||
|-  | |-  | ||
| + | | colspan="2" | Filter Colour; Red = 0, Green = 1, Blue = 2 and White = 3   | ||
|-  | |-  | ||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-  | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | 
| width="90%" style="border-top: 2px solid #000;" | ''Return''  | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
|}  | |}  | ||
| + | ===SetFrequencyRange===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetFrequencyRange'''  | 
|-  | |-  | ||
| − | | colspan="2" | Dynamically change the sensor   | + | | colspan="2" | Dynamically change the sensor output frequency range to a new setting   | 
|-  | |-  | ||
|-  | |-  | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| − | | width="90%" |   | + | | width="90%" | Freq  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Percentage range (2,20,100)   | 
|-  | |-  | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| Line 123: | Line 164: | ||
| + | ===SetLEDOff===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| Line 136: | Line 178: | ||
| + | ===SetLEDOn===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDOn'''  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Turn on the White LEDs   | 
|-  | |-  | ||
|-  | |-  | ||
| Line 147: | Line 190: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return''  | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
|}  | |}  | ||
| − | |||
| − | |||
Latest revision as of 13:09, 7 February 2023
| Author | Matrix TSL | 
| Version | 1.1 | 
| Category | Light | 
Contents
Colour Sensor component
This board provides the ability to detect colours using the TCS3200 sensor. It will return RGB and W values, dependent on the colour of the object under test.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Colour_TCS3200.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Colour_TCS3200.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
GetFrequency
| GetFrequency | |
| Samples and returns the sensor output frequency (Hz) | |
| Return | |
Initialise
| Initialise | |
| Initialise the sensor configuration as set by the component properties | |
| Return | |
SetConfig
| SetConfig | |
| Sends the config data byte to the sensor using clock and data pins | |
| Data | |
| Return | |
SetFilter
| SetFilter | |
| Dynamically change the sensor filter to RGB or W. Red = 0 Green = 1 Blue = 2 White = 3 | |
| FilterColour | |
| Filter Colour; Red = 0, Green = 1, Blue = 2 and White = 3 | |
| Return | |
SetFrequencyRange
| SetFrequencyRange | |
| Dynamically change the sensor output frequency range to a new setting | |
| Freq | |
| Percentage range (2,20,100) | |
| Return | |
SetLEDOff
| SetLEDOff | |
| Turn off the White LEDs | |
| Return | |
SetLEDOn
| SetLEDOn | |
| Turn on the White LEDs | |
| Return | |