• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Does not name a type error

Q&A Forum › Category: ESP8266 › Does not name a type error
0 Vote Up Vote Down
plwr1512 asked 6 years ago

I am building this recent project and see it uses a BME280 module. “ESP32/ESP8266 Insert Data into MySQL Database using PHP and Arduino IDE”  I have a BMP180 module and gather it should be able to work in this project instead of BME280. I have altered all wording in the script to BMP180 and have downloaded the zipped libraries to support the BMP180.

However the code won’t compile and comes back with errors such as…

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

esp8266_msql2:52:1: error: 'Adafruit_BMP180' does not name a type
Adafruit_BMP180 bmp; // I2C
^
C:\Users\Paul\Documents\Arduino\Iotplayground2\esp8266_msql2\esp8266_msql2.ino: In function 'void setup()':
esp8266_msql2:70:17: error: 'bmp' was not declared in this scope
bool status = bmp.begin(0x76);
^
C:\Users\Paul\Documents\Arduino\Iotplayground2\esp8266_msql2\esp8266_msql2.ino: In function 'void loop()':
esp8266_msql2:90:81: error: 'BMP' was not declared in this scope
+ "&location=" + sensorLocation + "&value1=" + String(BMP.readTemperature())
^
esp8266_msql2:91:49: error: 'bmp' was not declared in this scope
+ "&value2=" + String(bmp.readHumidity()) + "&value3=" + String(bmp.readPressure()/100.0F) + "";
^
exit status 1
'Adafruit_BMP180' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Can anyone see what I have done wrong or offer any suggestions??

3 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

The code doesn’t work with the BMP180 sensor by default. You need to install the BMP180 library in your Arduino IDE: github.com/adafruit/Adafruit_BMP085_Unified

Then, you need to follow the example and make all the necessary changes to make it work with that sensor (import the right library, init the sensor, etc): github.com/adafruit/Adafruit_BMP085_Unified/blob/master/examples/sensorapi/sensorapi.pde

0 Vote Up Vote Down
plwr1512 answered 6 years ago

Hi, I have downloaded the BMP085 unified into the Arduino IDE. I cannot see the however what is required to make the BMP180 sensor work, where is that information located?? I have looked all over the github.com/adafruit/Adafruit_BMP085_Unified/blob/master/examples/sensorapi/sensorapi.pde.

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

You need to follow that exact example:

  • github.com/adafruit/Adafruit_BMP085_Unified/blob/master/examples/sensorapi/sensorapi.pde

However, I simply recommend to try to compile that exact example first and see if you can read the sensor with that sketch. Does it work?

Then to merge with my database example, import those libraries:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>

Prepare it:

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

Start the sensor (in the setup):

/* Initialise the sensor */
if(!bmp.begin())
{
/* There was a problem detecting the BMP085 ... check your connections */
Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
while(1);
}

For example, to get the temperature:

float temperature;
bmp.getTemperature(&temperature);

After adding all those lines, can you compile it?

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.