Smokehead:
is there a way to send hex values like 0x01, 0x02, ... etc. from PC to Arduino vs serial monitor?
Why do you need to do that?
In general you can only send printable characters with the Serial Monitor.
I find that it greatly simplifies debugging if all communication between my PC program and the Arduino uses human-readable characters. That way you can do tests with the Serial Monitor acting in place of your PC program.
...R
PS. Perhaps it would be worthwhile to take a small amount of time to write a new C++ equivalent of my Python program and get that working.
if you are using Windows the RealTerm terminal emulator
the Send tab allows you to enter text such as 0x61 0x62 0x63 0x30 0x31 which is transmitted as a sequence of byte values when the Send Numbers button is hit, e.g. the Arduino program
If the OP can manage with sending a character or character string and doesn't actually want to write his own tool then he may want to look at my ESM version 4 recently released which also shows in the sample sketch parsing out data and converting to byte, int, char etc.
Sorry for the late answer and the poor choice of words. Actually i want to send a byte including values which can not be displayed as character properly.
But i could solve the problem. Actually it was a mistake while initializing the serial port. I forgot to reset the termios.c_lflag.
After doing this everythings fine. This would explain why it worked after starting the IDEs Serial Monitor.
Thanks for your help. Here's the code which i use to initialize the serial port:
SerialPortSettings.c_cflag &= ~PARENB; /*CLEAR Parity Bit PARENB*/
SerialPortSettings.c_cflag &= ~CSTOPB; /*Stop Bits = 1 */
SerialPortSettings.c_cflag &= ~CSIZE; /* Clears the Mask */
SerialPortSettings.c_cflag |= CS8; /* Set the data bits = 8 */
SerialPortSettings.c_cflag &= ~CRTSCTS;
SerialPortSettings.c_cflag |= CREAD | CLOCAL;
SerialPortSettings.c_iflag &= ~(IXON | IXOFF | IXANY);
SerialPortSettings.c_lflag |= ~(ICANON | ECHO | ECHOE | ISIG); //This one wasnt "c_lflag" but "c_iflag" by mistake.
SerialPortSettings.c_cc[VMIN] = 0;
SerialPortSettings.c_cc[VTIME] = 0;
tcsetattr(m_Port, TCSANOW, &SerialPortSettings);