Go Down

Topic: Using Screen instead of Arduino's built-in serial monitor (Read 1 time) previous topic - next topic

Sudar

I am currently using a makefile [1] to compile and upload Arduino. I wanted to integrate communication with the serial port also as part of my workflow.

For that I am currently using GNU Screen instead of the built-in Serial monitor.

One problem that I am currently facing with screen is that, if I write something back in screen, then Arduino is receiving the Ascii value of it. So if I type 'a' the Arduino receives 97.

Is there a way to overcome this? Also any idea how the built-in serial monitor handles this?

[1] - https://github.com/sudar/Arduino-Makefile
Checkout some of my Arduino projects and tutorials

bill2009

I think your problem is at the arduino end rather than the pc software. Try reading/printing your data as char's rather than byte or int.

Grumpy_Mike

Quote
One problem that I am currently facing with screen is that, if I write something back in screen, then Arduino is receiving the Ascii value of it.

That is not a problem that is how it works.

Quote
So if I type 'a' the Arduino receives 97.

What do you want to receive when you type 'a'?
It is a number that represents the letter. Computers only deal with numbers, letters are an interpretation we put on numbers sometimes.

Sudar


Try reading/printing your data as char's rather than byte or int.


This solved the issue.

Just to clarify (for the sake of future readers)

Serial.println() is a overloaded function. It does different things based on the data type that is passed to it.

If you use

Code: [Select]
Serial.println(Serial.read())

then it will print the ascii value of what ever you are entering. 97 for 'a' etc.

But if you use this code

Code: [Select]
char c = Serial.read()
Serial.println(c);


It will write the actual character that you typed.
Checkout some of my Arduino projects and tutorials

Grumpy_Mike

If you want to do that you can use Serial.write() in place of Serial.read()

Sudar


If you want to do that you can use Serial.write() in place of Serial.read()


Did you mean use Serial.write() instead of Serial.println()?
Checkout some of my Arduino projects and tutorials

Go Up