Pages: [1]   Go Down
Author Topic: Using Screen instead of Arduino's built-in serial monitor  (Read 1114 times)
0 Members and 1 Guest are viewing this topic.
Bangalore, India
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Checkout some of my Arduino projects and tutorials

ottawa, canada
Offline Offline
God Member
*****
Karma: 6
Posts: 991
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34239
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Bangalore, India
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
char c = Serial.read()
Serial.println(c);

It will write the actual character that you typed.
Logged

Checkout some of my Arduino projects and tutorials

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34239
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Bangalore, India
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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()?
Logged

Checkout some of my Arduino projects and tutorials

Pages: [1]   Go Up
Jump to: