As the title says... Chat on...

User avatar
By cyberrat
#14484 Hi All,
I have a lot of fun with the latest version 0.9.5 of NodeMCU but I have a strange issue and I don't understand why.

First let me resume the situation.

I updated to ESP-1 with NodeMCU I was able to upload code into ESP without any problem able to compile to save memory.
I would like to USE my BMP180 I found this module.

https://github.com/javieryanez/nodemcu-modules/tree/master/bmp180

Here below is the current file into de ESP-1

----------------------------
bmp180.lc : 3160 bytes --- Compile version
bmp180.lua : 4174 bytes --- No compile version
script2.lc : 1548 bytes
wireless.lc : 272 bytes
----------------------------
Total file(s) : 4
Total size : 9154 bytes

Total : 68021 bytes
Used : 10793 bytes
Remain: 57228 bytes

IF I execute the the "bmp180.lua" I receive an error about index is nul at line 12.

> dofile("bmp180.lua")
bmp180.lua:12: table index is nil

After that I would like to read the value and I execute this

> OSS = 1 -- oversampling setting (0-3)
> SDA_PIN = 2 -- sda pin, GPIO2
> SCL_PIN = 0 -- scl pin, GPIO0
> bmp180 = require("bmp180")
> bmp180.init(SDA_PIN, SCL_PIN)
no i2c for D0bmp180.read(OSS)
init() must be called before read.t = bmp180.getTemperature()
> p = bmp180.getPressure()
> print("Pressure: "..(p).." Pa")
stdin:1: attempt to concatenate global 'p' (a nil value)

Anyone have already got this error ?