Serial Monitor with Two Inputs

I apologize if this isn't the correct place to ask this question.

Can the Serial Monitor Tool display more than one input at a time? For example, a push button and a potentiometer from a single Arduino in one Serial Monitor display?

Regards,
Aaron Shore

Welcome to the forum

I have moved your topic to the Project Guidance category of the forum

The Serial monitor can simultaneously display the value of as many inputs as you like so two is no problem

explain what you mean by

Sorry, I mean display 2 inputs at the same time in Serial Monitor.

You mean something like this crude example ?

void setup()
{
    Serial.begin(115200);
    pinMode(4, INPUT);
}

void loop()
{
    Serial.println(digitalRead(4));
    Serial.println(analogRead(A3));
}

Why would you think that it would not work ?

You answered my question. So, I can display more than one input. Thank you

Note that although you can display the state of multiple input states you cannot control the cursor position, nor clear the screen, so output of multiple values can be messy and difficult to read

More to the point:

You can serial print whatever you want.

You can read sensors however you need to.

There is no connection between the two activities. At least not inherently - any connections are the ones you choose to make.

As noted, the serial monitor has limits. Chief among them is that what you print goes scrolling off the top of the screen, and of course you can't print something that will appear above something you've printed already.

a7

if you want them on the same line use print and only println for the last one to go to next line

void setup() {
    pinMode(4, INPUT);
    Serial.begin(115200);
}

void loop()
{
  Serial.print("D4 = "));
  Serial.print(digitalRead(4) == HIGH ? "HIGH" : "LOW");
  Serial.print(" and A3 = "));
  Serial.println(analogRead(A3));
  delay(1000);
}

that will result in printing if D4 is HIGH or LOW and the sampled value on A3 in one line and repeat every second

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.