Hi all,
As you see I'm new to Arduino world, so please help about the following problem :
I'm sending a string from Android to Arduino trough bluetooth, and I wand to ensure this string by calculating CRC.
In my java code my string is : ":0100000035" it's CRC = E9601FB
in my sketch I have a function that calculate CRC :
Serial.println("CRC OF :0100000035");
Serial.println(crc_string(":0100000035"), HEX); => E9601FB
Is this crap supposed to compile?
no of course, I'm showing you the diffence between the results given by Serial.println(crc_string(bufferline), HEX); and Serial.println(crc_string(":0100000035"), HEX);
Why? Why not simply pass line to the function? Or, use strcpy() or memcpy()?
Anonymous Serial.print() statements are next to useless.
Serial.print("bufferline: [");
Serial.print(bufferline);
Serial.print("]");
conveys FAR more information.
The hole line is supposed to be longer than 11, let's say 11+(CRC calculated by android), in arduino side, I will extract the data lenght of 11 calculate it's CRC and comparing it to the CRC calculated by Android to ensure the integrity of the received data, that's the idea
Then why are you dealing with only 11 characters? Why are you using an array that can only hold 11 characters?
What does that response have to do with not using a for loop or professionally tested function? What does that have to do with NOT bracketing and identifying what you are printing?
Then why are you dealing with only 11 characters? Why are you using an array that can only hold 11 characters?
What does that response have to do with not using a for loop or professionally tested function? What does that have to do with NOT bracketing and identifying what you are printing?
Thanks for the help, and sorry, I'm not understanding what you are trying to tell me, or that could be that I missexplained the problem.
or that could be that I missexplained the problem.
I'm not convinced that you are sending the same data to the function when passing an array and when passing a literal. I'm trying to get you to prove (or disprove) that you are.
or that could be that I missexplained the problem.
I'm not convinced that you are sending the same data to the function when passing an array and when passing a literal. I'm trying to get you to prove (or disprove) that you are.
Yeah mee to, I'm not convinced to be sending the same data TYPE but the same let's say value whitch is ":0100000035"
or that could be that I missexplained the problem.
I'm not convinced that you are sending the same data to the function when passing an array and when passing a literal. I'm trying to get you to prove (or disprove) that you are.
Yeah mee to, I'm not convinced to be sending the same data TYPE but the same let's say value whitch is ":0100000035"
As I said, it's data type problem, my reading was line[count] = (byte)BTSerial.read(); and when I changed it to line[count] = (char)BTSerial.read(); the right CRC is calculated.