Easy enough in python ;) but I can't figure it out in C++
Trying to send an ASCII 220 to my parallax LCD to make it beep. First you send a 12 to clear the screen and then I want to send the 220 if the ECG value is greater than 3. (Code below runs in a loop module).
char in C/++ is only an integer type of a specific size. It is not a string type, although string types can be built out of them.
Because chars are simply integers, charval = 12 is valid code.
String literals ("hello", "\n") are aliases for pointers. Adding a pointer to an integer type has (for programmers new to C) surprising results. I won't go into the details of the semantics of charval + "\n" (if you're interested, google "pointer arithmetic"), but suffice it to say that it's not string concatenation.
The effect you're looking for can be achieved by doing unistd::write(portArr[0], "\x0C\n\xDC\n", 10);