Want to control an RGB LED via my IMP via an URL like this:
https://agent.electricimp.com/xxxxxxxxxxxx?rgb=#F49E17
Agent code:
if ("rgb" in request.query) {
local color = request.query.rgb;
if (color[0] == '#') { // line 228
local returnTable = {
argR = ASCIItoHex(color[1])*16 + ASCIItoHex(color[2])
argG = ASCIItoHex(color[3])*16 + ASCIItoHex(color[4])
argB = ASCIItoHex(color[5])*16 + ASCIItoHex(color[6])
};
device.send("rgb", returnTable); // send our color table to the imp
}
}
I keep getting this error in my browser:
Internal Server Error: the index '0' does not exist (line 228)
Have no clue what is wrong here , anyone got a suggestion?