no, the key used in the IDE to indicate a string is ready to send it no transmitted by default, otherwise there could be 2 '\n' and it would be impossible to sent a string of text without any line termination characters (e.g. '\n' or '\r')
Using it for what ?
Using the Serial monitor you must press Enter/Return in order to send the entered text
As others have noted, there are terminal emulators such as PuTTY and Coolterm that can send each character as it is entered
Did anyone say that extra characters were added to those entered apart from the user defined Line ending character or characters ?
To avoid confusion you should make it clear that your Serial monitor screenshot is taken from IDE 1.x and that IDE 2.x is different
Did anyone say that extra characters were added to those entered apart from the user defined Line ending character or characters ?
you didn't make it clear that the Enter key is stripped from what the user entered.
requirements need to be "complete, correct and unambiguous". Patents by lay need to be. It helps when explanations are as well
The Enter key is never added to what the user entered so it does not need to be stripped from it
What I said was complete, correct and unambiguous
Using the Serial monitor you must press Enter/Return in order to send the entered text
The Enter key is never added to what the user entered so it does not need to be stripped from it
why is that true?
a terminal emulator which is being discussed in this thread sends every keyboard character pressed.
on most systems, windows/linux, the Enter is is not stripped when entered thru a window or shell.
Using the Serial monitor you must press Enter/Return in order to send the entered text
must it be pressed with IDE 1.8 if there is a Send icon?
connected to my pc
What operating system does your PC use, Windows, Linux, Mac?
UKHeliBob:
Using the Serial monitor you must press Enter/Return in order to send the entered text
must it be pressed with IDE 1.8 if there is a Send icon?
In IDE 1.x, pressing Enter key is an option and NOT a must.
why is that true?
What the "Enter" key sends depends on the software that is running.
In this topic it has been assumed that the Serial monitor is being used to enter the text and it does not add characters apart from the user defined Line ending characters
Other terminal emulators have been mentioned and they have default and user defined options
As it happens, as far as I know, PuTTY always adds at least one character
In the context of this topic it would seem to be better to use PuTTY/Coolterm/ANOther emulator and send each character as they are entered. The Serial monitor cannot do that
In the context of this topic it would seem to be better to use PuTTY/Coolterm/ANOther emulator
Why do you need an emulator?
So that characters can be displayed as they are entered without the need to press Enter/Return/Click the Send button
So that characters can be displayed
Sorry, I did not see that it was a requirement that the characters be displayed on the PC, I thought they were only dispalyed on the 7 seg .
It's not the PC that they are going to be displayed on, rather a 7 segment display
Topic driven off a cliff.
when i enter the number or letter
You state "when I enter" which means you will press the key, then "Enter".
I left your segment mistakes in this code so you can fix them.
Code (common cathode 7seg):
void setup() {
Serial.begin(115200); // begin serial comm
Serial.println("Press (0 - 9, A - F) then ENTER");
pinMode(2, OUTPUT); //a
pinMode(3, OUTPUT); //b
pinMode(4, OUTPUT); //c
pinMode(5, OUTPUT); //d
pinMode(6, OUTPUT); //e
pinMode(7, OUTPUT); //f
pinMode(8, OUTPUT); //g
}
void loop() {
// ===== HW SERIAL ===== https://forum.arduino.cc/t/serial-input-basics-updated/382007
if (Serial.available()) { // if data is in the serial buffer
char command = Serial.read(); // read a byte
Serial.print("\nCommand received: ");
if (command == '\n') // if it is "\n" |\r" new line...
command = ' '; // ... change it to a "space"
else {
Serial.print(command); // print the command
// Serial.print(" "); // formatting
}
delay(50); // seems to help with discarding the CRLF
char crlf = Serial.read(); // read and discard CRLF
switch (command) {
case 'a': // lower case command
case 'A': a(); break;
case 'b':
case 'B': b(); break;
case 'c':
case 'C': c(); break;
case 'd':
case 'D': d(); break;
case 'e':
case 'E': e(); break;
case 'f':
case 'F': f(); break;
case '0': nul(); break;
case '1': een(); break;
case '2': twee(); break;
case '3': drie(); break;
case '4': vier(); break;
case '5': vijf(); break;
case '6': zes(); break;
case '7': zeven(); break;
case '8': acht(); break;
case '9': negen(); break;
default: reset(); Serial.print(" (invalid)"); break;
}
}
}
void nul() {
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
};
void een() {
digitalWrite(5, HIGH);
digitalWrite(8, HIGH);
};
void twee() {
digitalWrite(2, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
};
void drie() {
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(2, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
};
void vier() {
digitalWrite(3, HIGH);
digitalWrite(2, HIGH);
digitalWrite(8, HIGH);
digitalWrite(5, HIGH);
};
void vijf() {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
};
void zes() {
digitalWrite(4, HIGH);
digitalWrite(3, HIGH);
digitalWrite(2, HIGH);
digitalWrite(6, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
};
void zeven() {
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(8, HIGH);
};
void acht() {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
};
void negen() {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
};
void reset() {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
};
void a(){reset();};
void b(){reset();};
void c(){reset();};
void d(){reset();};
void e(){reset();};
void f(){reset();};
diagram.json for wokwi
{
"version": 1,
"author": "foreignpigdog x",
"editor": "wokwi",
"parts": [
{ "type": "wokwi-arduino-nano", "id": "nano", "top": -4.8, "left": -0.5, "attrs": {} },
{
"type": "wokwi-7segment",
"id": "sevseg1",
"top": -91.02,
"left": 139.48,
"attrs": { "common": "cathode" }
}
],
"connections": [
[ "nano:2", "sevseg1:A", "gray", [ "v-96", "h57.6" ] ],
[ "nano:3", "sevseg1:B", "violet", [ "v-96", "h76.8" ] ],
[ "nano:4", "sevseg1:C", "blue", [ "v-9.6", "h76.8" ] ],
[ "nano:5", "sevseg1:D", "green", [ "v-9.6", "h67.2" ] ],
[ "nano:6", "sevseg1:E", "gold", [ "v-9.6", "h67.2" ] ],
[ "nano:7", "sevseg1:F", "orange", [ "v-96", "h67.2" ] ],
[ "nano:8", "sevseg1:G", "#8f4814", [ "v-96", "h86.4" ] ],
[ "nano:GND.2", "sevseg1:COM.2", "black", [ "v-105.6", "h28.8" ] ]
],
"dependencies": {}
}
It's not the PC that they are going to be displayed on, rather a 7 segment display
That is what I said. So why an emulator?
That is what I said. So why an emulator?
to display characters as they are entered. The Serial monitor only sends strings (1+) character after the Enter key is pressed or the Send icon clicked
As it happens, as far as I know, PuTTY always adds at least one character
why would it do that, apart possibly from sending '\r' and '\n"? A terminal was used to login to mainframes and minis. How could you enter a password if the terminal added characters
to display characters as they are entered.
I see no requirement that they be displayed on the PC only on the 7 seg display.
I see no requirement that they be displayed on the PC only on the 7 seg display.
yes.
so the goal is display characters on the 7 segment display (???) received thru the Serial interface. Since the Serial monitor only sends complete strings, entering 1+ characters on the Serial monitor would only result in seeing the last character received.
yes, you could just enter 1 character at a time thru the Serial monitor, hitting the Enter key or SEND icon after each. But apparently the goal is to be able to hit a single key on a keyboard and see it displayed. Hence the suggestion for using a terminal emulator which sends one character at a time as the key is pressed.

