Home        Store        Docs        Blog

How to erase the "----" when I'm reading the Bar30 sensor on my serial monitor?


(Fonz) #1

Hi! I’m reading my Bar30 sensor using the suggested arduino library, the problem that I have is that even erasing the code lines that have the intructions to print the units and names of measurements I’m still reading “----” How can I erase it?

Ill show you the last part of my code

void loop() {

sensor.read();

Serial.print(sensor.pressure());
delay(50);
}


and I’m reading
1010.30---- 1010.80---- 1010.40---- 1010.80---- 1010.20---- 1010.30---- 1010.20---- 1011.10---- 1010.90---- 1010.50----
I should not be reading the pressure with the dashes.

What can I do? I want to get only the numbers without dashes and line feed.

Thank you!


(Glen) #2

Hi,

So we had this exact same issue.

What I did was this;

  1. Download library of the sensor off github.
  2. Open the zip file and find the header file. ('.h file')
  3. Before adding the library to into ardiuno, I opened the header file in DevC++. (you try any other C compatible programmes)
  4. Search using 'Ctrl+F' for 'print'
  5. One of the print commands in the header file are for the dashes.
  6. Simply comment or delete the command.
  7. Save the header file.
  8. Now that you have made the change you can add the library to Ardiuno.

(Fonz) #3

It worked perfect! Thank you so much!, Only I have one correction; the archive which requires the modification is the “.cpp” file.

The only line that I commented is:

//Serial.println("----");
Have fun!!

(Glen) #4

Hi Fonz!

So Sorry! Mixed the two up! Lol!

Glad it worked!

Hope your project goes great!!