Print header with serial monitor

Hello,

I am using an Arduino Uno. I am following a course I have to solve a question. I have used the serial monitor to solve this so that is done. But I am not totallu satisified with the code I used for the monitor. I have got 2 columns, Input and Output. If I upload the sketch the serial monitor will show the in put and output so that is nice. But what I would like, when scrolling the headers "Input" and "Output" would stay on top so you know what you are looking at. Like blocking titles in excel. Does anyone know if this even is possible?

Test_program.ino (665 Bytes)

No, you can't do that. Serial monitor is just a raw stream of what you send. All you can do is repeat the header every x lines or so. That way it's always visible in the stream being it not at the top all the time.

If you don't like that you would have to make your own computer application :slight_smile:

So.. You are saying that this works?

int LM35pin = A0;  // Sensor op poort A0
int LM35Value = 0; // Variabele voor sensorwaarde
int IntLM35Value = 0;
int IntCelcius = 0;


void setup() {
  // Stel de seriële communicatie in:
  Serial.begin(9600);
}

void loop() {
  // Lees de waarde van de LM35:
  LM35Value = analogRead(LM35pin);
  IntLM35Value = map (LM35pin, 0, 1, 0, 205);
  IntCelcius = map (LM35Value, 0, 205, 0, 100);
  // Print titel naar de Seriële monitor:
  Serial.print("Meetspanning: ");
  Serial.print (IntLM35Value);
  // Print waarde naar de Seriële monitor:
  Serial.print ("\tGraden Celcius: ");
  Serial.println(IntCelcius);
  // Wacht 500 milliseconden:
  delay(500);
}

You may want to read up on how the Arduino map thing works : Link

  LM35Value = analogRead(LM35pin);               // reading the analog value into LM35Value.
  IntLM35Value = map (LM35pin, 0, 1, 0, 205);      // Mapping the pin number from 0..1 -> 0..205?? Makes no sense.. A) Mapping the pin number is poitless. B) Trying to mat an int from 0..1 is pointless, Its one or the other.
  IntCelcius = map (LM35Value, 0, 205, 0, 100);  // Taking the result of the last line and mapping that to 0..100   //

Anyhow, look a little closer. You'll get there.

-jim lee

? I think I did not upload my newest sketch. But if it is not possible without printing it again and again then it is what it is. Thanks for the quick replies.

You could consider using a terminal emulator program that allows cursor positioning so that the values scroll upwards whilst the headings remain in place on the screen but the programming is going to be more complicated

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