Hot answers tagged

2

Your code loops from the high order byte to the low order byte, printing each byte as 2 hex digits. If you want instead to print the first byte as a decimal value, and then the remaining bytes as another decimal value, then do this: Print byte 0 in base 10: Serial.print(data[0]); //first byte Serial.print(":"); Then loop through the remaining ...


1

If there are no other constraints, send them as a text with delimiters and a terminating character. e.g. something like "123;45;678\n" On the arduino, either manually check for those delimiters and convert the digits to a number on the fly, or use strtok and atoi after reading the whole line.


1

The accepted way to initialize an array in C follows this example: const char ID [] = {111, 11, 11, 11}; You can read more about it here. You later use an array name ("ID") with no index ("ID[0]"). The C compiler assumes the programmer who uses an array name with no index is interested in the memory address of the first element of the array. But you ...


Only top voted, non community-wiki answers of a minimum length are eligible