i am using TCS3200 Color Sensor. is there any node for that sensor ??
There does not appear to be an existing node built-in or in the XOD libraries Libraries — XOD
The code required seems to be fairly simple Arduino Color Sensor TCS230 TCS3200 | Random Nerd Tutorials Set output pins connected to sensor to select color, then use PulseIn to read a frequency value. Sample above seems to indicate that manually calibrating frequencies read to actual colors is required. I would think the node would require input pins for specifying ports used and UPD to indicate when new value should be read. Output pins would be needed for 4 color frequencies, and a done pulse to indicate reads have completed. Since PulseIn is needed, the node would have to be coded in C++, which makes it a bit harder. Using an existing node as a template would make coding easier, but finding an appropriate node written in C++ is not trivial. I don’t know if any existing nodes use pulsein. The only way to find which nodes are coded in C++ is to open each node & see. Any node that looks like it might be simple with port & UDP inputs and some output would be a potential candidate to use as your template.
Actually, I see that robertspark/components — XOD has a pulsein node, so you could probably code this up using digital-write & this pulsein node without coding in C++. Even then, the code will not be trivial since you will need to use pulses to control flow to set pins on sensor, read pulse, reset pins on sensor, read pulse, etc. to get pulse readings for each color. You could get around that by writing separate nodes to read each color, but you would have to make sure only one of those nodes was called at a time; you will get garbage results if you attempt to read a second color before the previous read has completed. You could even code this as 4 color nodes, then wrap them all in another patch that executes them one at a time & presents all 4 values on output pins. The Nerd Tutorials page linked above will tell you what values you to need to set on each pin (digital-write) before using the pulsin node to read frequency.
You could start by just reading value for red filters, then test with white, red, pink, & black patches to see output. Once that seems to be working, add code to get readings for other colors.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.