Originally Posted by
laserlight
I wrote "where the type of numBytes is the return type of Udp.read". This has absolutely nothing to do with the type of packetBuffer, which is in fact char[256], not char. The return type of Udp.read is probably size_t, or another unsigned integer type, or possibly a signed integer type (most probably int or larger, in that case). This makes sense: packetBuffer is an array of char because it is well, a buffer, i.e., the bytes read themselves, whereas the return type of Udp.read is some type suited to representing the number of bytes read.
That's what I wrote in post #6: "You can also do additional error checking to confirm that the content of packetBuffer are digits before you do the computation." You don't have to do this error checking, but then if the buffer does have three bytes read yet is invalid, your users will either get harder to understand error messages, or worse still, an incorrect tableID that could be very hard to diagnose.
That's what Click_here told you in post #8 and which you said worked in post #9, except that the ID was not set correctly. Admittedly it was a typo error on my part, but I was typing it out on my phone so it is more difficult to spot such mistakes.
You might want to post your current code or update your pastebin.
The reason why you have 861 lines of code in your pastebin right now is that you haven't made good use of abstraction: you keep repeating the same code over and over again instead of moving them into functions that you can call with varying arguments. This is sometimes called the DRY principle: Don't Repeat Yourself.
I also understand that you might reasonably have global state and hence global variables, but you should still think very carefully before you declare a global variable. Just because a variable is used in multiple functions doesn't mean it represents global state, e.g., lightSensor is always used locally to store the return value of a function, so it should be a local variable. You should also use const for variables that actually represent constants rather than variables to be modified at run time.
That's something that's domain specific, i.e., you would need to refer to the documentation for this UDP multicolor lamp. What I can tell you is that by storing the ID in an unsigned char, you're limited to the range [0, UCHAR_MAX], where UCHAR_MAX is at least 255.