Hi, I have a simple project where I want to display a DHT sensor values to a local web server.
I have managed to display the values through AWS and Losant. But, I haven’t managed to display the values locally. I have no clue what syntax or code in Mongoose I should use to connect the .js file and .html file.
If you have some other way to display the values locally, please feel free to suggest it.
Thanks in advance.
Here’s some references for the code I used : DHT sensor Losant
.
.
.
This is my goal:
I added the libraries you mentioned and these lines on my js code:
let t = dht.getTemp();
let h = dht.getHumidity();
RPC.addHandler('StatusDHT', function(){
return JSON.stringify({
data:{
temp : t,
humid : h
}
});
})
Are these lines correct for defining an RPC function?
And sorry I’ve tried searching, but I still don’t know how to call an RPC function on my html file.
I’ve added this line on html to connect both files.
<script src="init.js"></script>
Could you help me on how to call the function?
Thanks again for helping.