Serial Monitor in one line

when I run the code below the serial monitor data are all in one line how can I make each input in each line?

int fsrPin = 0;     // the FSR and 10K pulldown are connected to a0
int fsrReading;     // the analog reading from the FSR resistor divider
int led = 13;
 
void setup(void) {
  pinMode (led, OUTPUT);
  Serial.begin(9600);   
}
 
void loop(void) {
  fsrReading = analogRead(fsrPin);  
 
  Serial.print("Analog reading = ");
  Serial.print(fsrReading);     // print the raw analog reading
  int Counter = 0;
  if (fsrReading >0) {
Counter=Counter+1;
if (Counter==50){
 digitalWrite (led,HIGH);
}
else{
 digitalWrite (led,LOW);
}

  delay(1000);
}
}

it looks like this

Analog reading = 0Analog reading = 0Analog reading = 0Analog reading = 0Analog reading = 0Analog reading = 0

how to make it looks like this
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0
Analog reading = 0

Like that

1 Like

Have you tried

?

There is no good reason that fsrReading should have global scope

There are very good reasons why "led" and "fsrPin" should be "const byte".

There are even better reasons "Counter" should be "static".
This has been pointed out to you before

The counter doesn't work so LED doesn't turn on I don't how to fix this I tried so much

See reply #4

1 Like

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