Hello All,
I am facing error while trying to compile DHT11 sensor for humidity.
I have copied DHT11 sensor library to "C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master"
Then I try to compile to compile the below code. But I am facing error :
I am facing error while trying to compile DHT11 sensor for humidity.
I have copied DHT11 sensor library to "C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master"
Then I try to compile to compile the below code. But I am facing error :
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public Serial1 As Serial
Public Humid,temperature As Float
Private pin10 As Pin
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
pin10.Initialize(10,pin10.MODE_OUTPUT)
timer1.Initialize("timer1_Tick",1000)
timer1.Enabled=True
RunNative("setup",Null)
End Sub
Private Sub timer1_tick()
RunNative("read", Null)
Log("Humidity :",Humid)
End Sub
#if C
#include "dht.h"
DHT dht
void setup(B4R::Object* o){
dht.begin();
}
void read (B4R::Object* o) {
b4r_main::_humid = dht.readHumidity();
b4r_main::_temperature =dht.readTemperature();
}
#End if