i was searching on this forum (and not only) and i couldnt find my answer anywhere,
i only saw strncat fuction that is for strings
so
i have :
int temp_1=5;
int temp_2=6;
int temp_2=9;
int temp_3;
I want the temp_3 to have the 569 value, (something like temp_1 & temp_2 & temp_3)
any solution?
int temp_1=5;
int temp_2=6;
int temp_3=9;
int temp_3 = (temp_1*100) + (temp_2*10) + (temp_3); // 569
int temp_4 = (temp_1 * 100) + (temp_2 * 10) + temp_3;
If you are reading this in as serial data, multiply the previous value by 10 before adding the new value.
int aVal = 0;
char aChar = Serial.read();
if(aChar >= '0' && aChar <= '9')
{
aVal *= 10;
aVal += aCahr - '0';
}
oh my god, how can i be so stupid to think something like that!!!
I need a doctor....