TCS34725 On Raspberry Pi

I am having issues pulling data from RGB sensor using Raspberry pi Zero.
can anyone help me out with a sample code .
this is my first post sorry for any wrong posting issues.

[{"id":"466a72cc.9b04fc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"c93fe99f.2e9378","type":"inject","z":"466a72cc.9b04fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":400,"wires":[["59890c25.0f4fe4"]]},{"id":"59890c25.0f4fe4","type":"i2c in","z":"466a72cc.9b04fc","name":"","address":"41","command":"0","count":"8","x":390,"y":400,"wires":[["8ba66948.c892e8","81d74fa1.9607f"]]},{"id":"f9148dc8.7669c","type":"debug","z":"466a72cc.9b04fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":870,"y":400,"wires":[]},{"id":"8ba66948.c892e8","type":"function","z":"466a72cc.9b04fc","name":"","func":"var a = { payload: msg.payload[0] };\nvar b = { payload: msg.payload[1] };\nvar Msg2 = { payload: msg.payload[2] };\nvar Msg3 = { payload: msg.payload[3] };\nvar Msg4 = { payload: msg.payload[4] };\nvar Msg5 = { payload: msg.payload[5] };\nvar Msg6 = { payload: msg.payload[6] };\nvar Msg7 = { payload: msg.payload[7] };\n\nvar Clear = {payload:a} + {payload:b};\n\n\n\n\n\n\nglobal.set("variable-name",a)\nglobal.set("variable-name1",b)\nreturn Clear;","outputs":1,"noerr":0,"x":570,"y":400,"wires":[["f9148dc8.7669c"]]},{"id":"81d74fa1.9607f","type":"function","z":"466a72cc.9b04fc","name":"","func":"var a = { payload: msg.payload[0] };\nvar b = { payload: msg.payload[1] };\nvar Msg2 = { payload: msg.payload[2] };\nvar Msg3 = { payload: msg.payload[3] };\nvar Msg4 = { payload: msg.payload[4] };\nvar Msg5 = { payload: msg.payload[5] };\nvar Msg6 = { payload: msg.payload[6] };\nvar Msg7 = { payload: msg.payload[7] };\n\nreturn b;","outputs":1,"noerr":0,"x":570,"y":438,"wires":[[]]}]

It is not possible to import your flow the way it was posted. Please edit the post to include 3 backticks (```)before and after the code.

Also tell us what you expect and what you get.

@andrei I turned off the smart-quote auto formatting a couple weeks ago - so flows posted without the backticks are importable. But the backticks still make the post more legible, so still worth doing.

Thanks Nick. Anyway there was something weird with the posted flow , not related to smart-quote.

I had to escape the quotes, manually prepending backward slashes, in these two lines to manage to import the flow:

global.set(\"variable-name\",a) global.set(\"variable-name1\",b)

Hi @bbpogul,

This is how your code looks like.

var a = { payload: msg.payload[0] }; 
var b = { payload: msg.payload[1] }; 
var Msg2 = { payload: msg.payload[2] }; 
var Msg3 = { payload: msg.payload[3] }; 
var Msg4 = { payload: msg.payload[4] }; 
var Msg5 = { payload: msg.payload[5] }; 
var Msg6 = { payload: msg.payload[6] }; 
var Msg7 = { payload: msg.payload[7] };  
var Clear = {payload:a} + {payload:b};       
global.set("variable-name",a);
global.set("variable-name1",b);
return Clear;

Certainly it can be simplified and fixed but we need to understand how the data is structured in the output of the I2C node. Can you wire a debug node , configured to display the full message, directly to the I2C node to capture and share a screenshot of the debug panel ? This way we can see the message properties and provide some guidance on how to extract the relevant information.

Hello Andrei,

Thank you very much guys for helping me out.
I am just trying to get RGB values out of TCS34725 using I2C.
I am receiving data in an Array.

Sorry i have posted the right Flow (export)

[{"id":"466a72cc.9b04fc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d5900d0b.e3a8d","type":"mqtt-broker","z":"","name":"","broker":"www.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"869320ae.087a7","type":"ui_tab","z":"","name":"Garage","icon":"dashboard"},{"id":"5ab03ee9.8ea15","type":"ui_group","z":"","name":"Default","tab":"869320ae.087a7","disp":true,"width":"6","collapse":false},{"id":"b1960c96.51d89","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"c93fe99f.2e9378","type":"inject","z":"466a72cc.9b04fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":400,"wires":[["59890c25.0f4fe4"]]},{"id":"59890c25.0f4fe4","type":"i2c in","z":"466a72cc.9b04fc","name":"","address":"41","command":"0","count":"8","x":390,"y":400,"wires":[["8ba66948.c892e8","81d74fa1.9607f"]]},{"id":"f9148dc8.7669c","type":"debug","z":"466a72cc.9b04fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":870,"y":400,"wires":[]},{"id":"8ba66948.c892e8","type":"function","z":"466a72cc.9b04fc","name":"","func":"var a = { payload: msg.payload[0] };\nvar b = { payload: msg.payload[1] };\nvar c = { payload: msg.payload[2] };\nvar d = { payload: msg.payload[3] };\nvar e = { payload: msg.payload[4] };\nvar f = { payload: msg.payload[5] };\nvar g = { payload: msg.payload[6] };\nvar h = { payload: msg.payload[7] };\nvar Clear= a+b;\nvar Red = c+d;\nvar Green= e+f;\nvar Blue = g+h;\nreturn Clear;","outputs":1,"noerr":0,"x":570,"y":400,"wires":[["f9148dc8.7669c"]]},{"id":"81d74fa1.9607f","type":"function","z":"466a72cc.9b04fc","name":"","func":"var a = { payload: msg.payload[0] };\nvar b = { payload: msg.payload[1] };\nvar Msg2 = { payload: msg.payload[2] };\nvar Msg3 = { payload: msg.payload[3] };\nvar Msg4 = { payload: msg.payload[4] };\nvar Msg5 = { payload: msg.payload[5] };\nvar Msg6 = { payload: msg.payload[6] };\nvar Msg7 = { payload: msg.payload[7] };\n\nreturn b;","outputs":1,"noerr":0,"x":570,"y":438,"wires":[[]]}]

I wanted to know if you managed to read the data into the array and this data looks like. Can you wire the debug node directly to the output of the I2C node, deploy the flow and show what you get in the debug node after reading the sensor ? If we dont see how the data looks like it wont be possible to extract the part of the information that is relevant for you.