Looks like html error? BME/P 280

I’m trying to get a humidity and temperature reading from a BM E/P 280 Sensor with an Arduino UNO. The idea is to build a swamp cooler, And have the brains sense when either water is low in the reservoir (bucket lets be honest), or when the humidity or temperature reaches a certain setting, and turn off the pump and fan and display an error message. All of that for a later time, pretty simple logic to code really. But right now I’m getting this error message with the sample code on adafruit:

#include <Adafruit_BME280.h>

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11 
#define BME_CS 10
 
//Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

This is the error. It looks like something with HTML which makes no sense to me why it would be. Any ideas how to fix it?

Arduino: 1.8.5 (Windows 10), TD: 1.42-beta3, Board: "Arduino/Genuino Uno"

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:30:3: error: stray '\302' in program

   <title>Adafruit_Sensor/Adafruit_Sensor.h at master · adafruit/Adafruit_Sensor · GitHub</title>

   ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:30:3: error: stray '\267' in program

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:30:3: error: stray '\302' in program

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:30:3: error: stray '\267' in program

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:160:10: warning: missing terminating ' character

     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" data-scope-type="Repository" data-scope-id="7666349" data-scoped-search-url="/adafruit/Adafruit_Sensor/search" data-unscoped-search-url="/search" action="/adafruit/Adafruit_Sensor/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

          ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:160:5: error: missing terminating ' character

     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" data-scope-type="Repository" data-scope-id="7666349" data-scoped-search-url="/adafruit/Adafruit_Sensor/search" data-unscoped-search-url="/search" action="/adafruit/Adafruit_Sensor/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

     ^

You did something super screwy to download the Adafruit BME280 library. Do this:

  • Delete C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library.
  • Sketch > Include Library > Manage Libraries.
  • Wait for download to finish.
  • In the "Filter your search..." box, type "adafruit bme280".
  • Click on "Adafruit BME280 Library".
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".

In this case it was not necessary to manually download the library since it was in the Library Manager index. When you need a library that is not in the index, you can download it from GitHub by going to the main page of the repository, clicking "Clone or download", then clicking "Download ZIP".

And I’m posting the error in multiple posts because it won’t let me post the whole thing in one post:

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:392:17: error: too many decimal points in number

                 1.0.2

                 ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:402:17: error: too many decimal points in number

                 1.0.1

                 ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:412:17: error: too many decimal points in number

                 1.0.0

                 ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:605:70: error: stray '#' in program

         <td id="LC20" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">ifndef</span> _ADAFRUIT_SENSOR_H</td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:609:70: error: stray '#' in program

         <td id="LC21" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">_ADAFRUIT_SENSOR_H</span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:618:70: error: stray '#' in program

         <td id="LC23" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">if</span> ARDUINO &gt;= 100</td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:622:71: error: stray '#' in program

         <td id="LC24" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Arduino.h<span class="pl-pds">&quot;</span></span></td>

                                                                       ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:626:71: error: stray '#' in program

         <td id="LC25" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Print.h<span class="pl-pds">&quot;</span></span></td>

                                                                       ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:630:70: error: stray '#' in program

         <td id="LC26" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">else</span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:634:71: error: stray '#' in program

         <td id="LC27" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>WProgram.h<span class="pl-pds">&quot;</span></span></td>

                                                                       ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:638:70: error: stray '#' in program

         <td id="LC28" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">endif</span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:664:70: error: stray '#' in program

         <td id="LC34" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_GRAVITY_EARTH</span>             (<span class="pl-c1">9</span>.<span class="pl-c1">80665F</span>)              <span class="pl-c"><span class="pl-c">/*</span>*&lt; Earth&#39;s gravity in m/s^2 <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:668:70: error: stray '#' in program

         <td id="LC35" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_GRAVITY_MOON</span>              (<span class="pl-c1">1</span>.<span class="pl-c1">6F</span>)                  <span class="pl-c"><span class="pl-c">/*</span>*&lt; The moon&#39;s gravity in m/s^2 <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:672:70: error: stray '#' in program

         <td id="LC36" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_GRAVITY_SUN</span>               (<span class="pl-c1">275</span>.<span class="pl-c1">0F</span>)                <span class="pl-c"><span class="pl-c">/*</span>*&lt; The sun&#39;s gravity in m/s^2 <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:676:70: error: stray '#' in program

         <td id="LC37" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_GRAVITY_STANDARD</span>          (SENSORS_GRAVITY_EARTH)</td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:680:70: error: stray '#' in program

         <td id="LC38" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_MAGFIELD_EARTH_MAX</span>        (<span class="pl-c1">60</span>.<span class="pl-c1">0F</span>)                 <span class="pl-c"><span class="pl-c">/*</span>*&lt; Maximum magnetic field on Earth&#39;s surface <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:684:70: error: stray '#' in program

         <td id="LC39" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_MAGFIELD_EARTH_MIN</span>        (<span class="pl-c1">30</span>.<span class="pl-c1">0F</span>)                 <span class="pl-c"><span class="pl-c">/*</span>*&lt; Minimum magnetic field on Earth&#39;s surface <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:688:70: error: stray '#' in program

         <td id="LC40" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_PRESSURE_SEALEVELHPA</span>      (<span class="pl-c1">1013</span>.<span class="pl-c1">25F</span>)              <span class="pl-c"><span class="pl-c">/*</span>*&lt; Average sea level pressure is 1013.25 hPa <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:692:70: error: stray '#' in program

         <td id="LC41" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_DPS_TO_RADS</span>               (<span class="pl-c1">0</span>.<span class="pl-c1">017453293F</span>)          <span class="pl-c"><span class="pl-c">/*</span>*&lt; Degrees/s to rad/s multiplier <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:692:215: error: invalid digit "9" in octal constant

         <td id="LC41" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_DPS_TO_RADS</span>               (<span class="pl-c1">0</span>.<span class="pl-c1">017453293F</span>)          <span class="pl-c"><span class="pl-c">/*</span>*&lt; Degrees/s to rad/s multiplier <span class="pl-c">*/</span></span></td>

                                                                                                                                                                                                                       ^

Follow the instructions in my last reply and all that should be solved.

last one
C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:696:70: error: stray '#' in program

         <td id="LC42" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">define</span> <span class="pl-en">SENSORS_GAUSS_TO_MICROTESLA</span>       (<span class="pl-c1">100</span>)                   <span class="pl-c"><span class="pl-c">/*</span>*&lt; Gauss to micro-Tesla multiplier <span class="pl-c">*/</span></span></td>

                                                                      ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1152:71: error: stray '#' in program

         <td id="LC154" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">endif</span></td>

                                                                       ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1176:10: warning: missing terminating ' character

     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-to-line-form" action="" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

          ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1176:5: error: missing terminating ' character

     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-to-line-form" action="" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="&#x2713;" />

     ^

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1228:5: error: stray '\342' in program

     You can’t perform that action at this time.

     ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1228:5: error: stray '\200' in program

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:1228:5: error: stray '\231' in program

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:7:1: error: expected unqualified-id before '<' token

 <!DOCTYPE html>

 ^

In file included from C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:0,

                 from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:618:112: error: expected unqualified-id before '=' token

         <td id="LC23" class="blob-code blob-code-inner js-file-line">#<span class="pl-k">if</span> ARDUINO &gt;= 100</td>

                                                                                                                ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:622:152: error: expected unqualified-id before '<' token

         <td id="LC24" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Arduino.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                        ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:622:195: error: expected unqualified-id before '<' token

         <td id="LC24" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Arduino.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                                                                   ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:626:152: error: expected unqualified-id before '<' token

         <td id="LC25" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Print.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                        ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:626:193: error: expected unqualified-id before '<' token

         <td id="LC25" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>Print.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                                                                 ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:634:152: error: expected unqualified-id before '<' token

         <td id="LC27" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>WProgram.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                        ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:634:196: error: expected unqualified-id before '<' token

         <td id="LC27" class="blob-code blob-code-inner js-file-line"> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&quot;</span>WProgram.h<span class="pl-pds">&quot;</span></span></td>

                                                                                                                                                                                                    ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:777:72: error: expected unqualified-id before '<' token

         <td id="LC62" class="blob-code blob-code-inner js-file-line">} <span class="pl-c1">sensors_type_t</span>;</td>

                                                                        ^

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_Sensor.h:777:114: error: expected unqualified-id before '<' token

         <td id="LC62" class="blob-code blob-code-inner js-file-line">} <span class="pl-c1">sensors_type_t</span>;</td>

                                                                                                                  ^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

[/code]

Right so I did what you said, and it’s throwing the error:

In file included from C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino:1:0:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:29: fatal error: Adafruit_Sensor.h: No such file or directory

 #include <Adafruit_Sensor.h>

                             ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

When I make sure that Adafruit_Sensor.h is in the directory it throws the error I took three posts to publish. I would like to respond faster but I’m under a forum restriction that only allows me to post every 5 minutes (<100 posts). I don’t see an Adafruit_sensor anything in the library manager. I was using a DHT11 3-pin but it’s hideously inaccurate. So I’m trying to get to grips with this new sensor.

daxarms:
When I make sure that Adafruit_Sensor.h is in the directory it throws the error I took three posts to publish.

OK, so you did something screwy when you downloaded Adafruit_Sensor.h, and you were wrong from the start to thing you should solve the problem by dumping that file into the library.

daxarms:

C:\Users\mjmil\Documents\Arduino\libraries\Adafruit_BME280_Library/Adafruit_BME280.h:26:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

Whenever you see a “No such file or directory” error it means you need to install a library. In some cases you will find instructions for how to do that in the documentation for the code that requires the library. Sometimes the dependencies are not documented but it’s usually pretty easy to find them.

So what’s going on here is you have a sketch C:\Users\mjmil\Documents\Arduino\humidity\humidity.ino that requires the Adafruit BME280 Library. But the Adafruit BME280 Library requires the Adafruit Unified Sensor Library (as you would see if you checked the documentation for that library). So you only need to follow the same process as before:

  • Sketch > Include Library > Manage Libraries.
  • Wait for download to finish.
  • In the “Filter your search…” box, type “Adafruit unified Sensor abstraction layer”.
  • Click on “Adafruit Unified Sensor”.
  • Click “Install”.
  • Wait for installation to finish.
  • Click “Close”.

Thank you so much. I was searching something too vague. Still throwing an error but one that makes sense.

Yes, that one is difficult because there are so many search results if you only look for "Adafruit Sensor". It's unfortunate because so many libraries require the Adafruit Unified Sensor library. I recently got Arduino to make a change that should make it a bit easier to find library dependencies using the Library Manager search in the future.