Go Down

Topic: Question about converting Hex values from String (Read 461 times) previous topic - next topic

stonedonkey




Code: [Select]

int pixelID= (pixData.substring(0,pixData.indexOf(","))).toInt();
        String colorCode = pixData.substring(pixData.indexOf(",")+1, pixData.length());

        // convert from string to char to long unsigned int
        char tarray[8];
        colorCode.toCharArray(tarray, sizeof(tarray));
         unsigned long int color = strtoul(tarray, NULL,0);

        // set out lights
        animation[0].pixels.color[pixelID] = color;

PaulS

What was your question?

What kind of output are you expecting when you specify base 0?
The art of getting good answers lies in asking good questions.

Go Up