common792
Junior Member level 3
Hi Everyone
I am doing a placement and I am trying to learn a new IDE called Arduino. My Supervisor have asked me to modifiy this function called Void getLocalData() , but my issue that i do not understand it at all and i do not know where/how to start.
I am freaking out!
Here is the function
void getLocalData()
{
// Declare and generate random numbers.
short int val1 = getRndNumber(100);
short int val2 = getRndNumber(200);
short int val3 = getRndNumber(300);
short int val4 = getRndNumber(400);
short int val5 = getRndNumber(500);
short int val6 = getRndNumber(600);
short int val7 = getRndNumber(700);
short int val8 = getRndNumber(800);
// Local char strings are needed to store----------> instructions
// the random data.
char cVal1[7]=? ;
char cVal2[7]= ;
char cVal3[7]= ;
char cVal4[7]= ;
char cVal5[7]= ;
char cVal6[7]= ;
char cVal7[7]= ;
char cVal8[7]= ;
// Convert and store the random data.
itoa(val1, cVal1, 1);
itoa(val2, cVal2, 2);
itoa(val3, cVal3, 3);
itoa(val4, cVal4, 4);
itoa(val5, cVal5, 5);
itoa(val6, cVal6, 6);
itoa(val7, cVal7, 7);
itoa(val8, cVal8, 8);
// Construct the string that will store----------------->Instructions
// the final stream to be transmitted.
strcpy(cOutData,cVal1);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal2);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal3);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal4);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal5);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal6);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal7);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal8);
strcat(cOutData,ASCII_DELIM);
}
Can someone help me please?
Thank you
I am doing a placement and I am trying to learn a new IDE called Arduino. My Supervisor have asked me to modifiy this function called Void getLocalData() , but my issue that i do not understand it at all and i do not know where/how to start.
I am freaking out!
Here is the function
void getLocalData()
{
// Declare and generate random numbers.
short int val1 = getRndNumber(100);
short int val2 = getRndNumber(200);
short int val3 = getRndNumber(300);
short int val4 = getRndNumber(400);
short int val5 = getRndNumber(500);
short int val6 = getRndNumber(600);
short int val7 = getRndNumber(700);
short int val8 = getRndNumber(800);
// Local char strings are needed to store----------> instructions
// the random data.
char cVal1[7]=? ;
char cVal2[7]= ;
char cVal3[7]= ;
char cVal4[7]= ;
char cVal5[7]= ;
char cVal6[7]= ;
char cVal7[7]= ;
char cVal8[7]= ;
// Convert and store the random data.
itoa(val1, cVal1, 1);
itoa(val2, cVal2, 2);
itoa(val3, cVal3, 3);
itoa(val4, cVal4, 4);
itoa(val5, cVal5, 5);
itoa(val6, cVal6, 6);
itoa(val7, cVal7, 7);
itoa(val8, cVal8, 8);
// Construct the string that will store----------------->Instructions
// the final stream to be transmitted.
strcpy(cOutData,cVal1);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal2);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal3);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal4);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal5);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal6);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal7);
strcat(cOutData,ASCII_DELIM);
strcat(cOutData,cVal8);
strcat(cOutData,ASCII_DELIM);
}
Can someone help me please?
Thank you