Hello.
Apologize for the bad grammer ahead but I'll try my best to make myself clear.
First, I'd like to share two pieces of codes. Ones the master and one's the slave. Each part has a HC-05 module.
One is for sending informations, and one is for receiving it. In my case, I send the values of each color from RGB (0 too 255).
The following code is the function which sends the combined colors together, sends the String and is therefore the master.
void SendData()
{
StringList = String(RED) + "," + String(GREEN) + "," + String(BLUE);
HC05Serial.write('StringList');
}
The following code is the function for receiving the data from the master, so it's the slave.
void ReceiveData(void)
{
if (HC05Serial.available() > 0)
{
StringList = HC05Serial.read();
}
StringList.toCharArray(stringBuffer, 100);
for (str = strtok_r(stringBuffer, ",", &p); str; str = strtok_r(NULL, ",", &p))
{
colorRGBW++;
switch (colorRGBW)
{
case 1:
Upload = 1;
break;
case 2:
Upload = 2;
break;
case 3:
Upload = 3;
colorRGBW = 0;
break;
}
switch (Upload)
{
case 1:
LAMPRED = atoi(str);
break;
case 2:
LAMPGREEN = atoi(str);
break;
case 3:
LAMPBLUE = atoi(str);
break;
}
}
}
The code is all good and it has no syntax mistakes, but still I have a problem...
As soon as I open the Serial.Monitor on the slave part and try to read the variables, for example LAMPBLUE, I always get the number 116, no matter how the string from the master looks like.
For example, when I force the master over the software to send a string, which looks like this "255,0,0", that it would have to send only one color, I receive always the same at the slave .. namely "116,116,116".
The connection with the two modules does work btw. I checked the connection more than once, so the hardware should be correct. The NeoPixel, which gets the string later in the code also makes a reaction, but it does get always white. Of course that confirms, that it has a "116,116,116".
Does somebody know, what the problem could be or how I could get rid of this 116? I kinda can't relate, why exactly 116, so I decided to ask the forum. In the internet, I found sadly nothing to that.
If you need something, like more lines of the code, just respons shortly. I can send more if it's necassary.
Thanks in advance.
Stay healthy y'all ..