Colour picker using Node-Red Serially

Dependents:   noderedcolourpicker

Revision:
0:273a835b3148
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/node_red_parse.cpp	Thu Mar 30 12:36:05 2017 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+
+
+float led[5];
+
+float* stringparsing(char* buffer)
+{
+    
+    char * pch;
+    pch = strtok (buffer,",\"");
+//    printf("%s\n\r",pch);    
+    int i = 0;
+    while (pch != NULL)
+    {
+//        printf ("Inside function %s\n\r",pch);
+        led[i] = atoi(pch);
+        pch = strtok (NULL, ",\"");
+        i++;
+    }
+    led[0] = 1-(led[0]/255.0);
+    led[1] = 1-(led[1]/255.0);
+    led[2] = 1-(led[2]/255.0); 
+//    pc.printf("red %f\n\r",led[0]);    
+    return led;
+    
+}
\ No newline at end of file