#include "DHT.h"
#define DHTTYPE DHT11
#define dht_dpin 0
const int analog_ip = A0;
int inputVal = 0;
DHT dht(dht_dpin, DHTTYPE);
void setup() {
dht.begin();
Serial.begin(9600);
Serial.println("Humidity sensor \n\n");
delay(1000);
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("current humidity = ");
Serial.print(h);
Serial.println("% ");
Serial.print("\ncurrent temperature = ");
Serial.print(t);
Serial.println("C ");
inputVal = analogRead (analog_ip);
Serial.print("\ncurrent heartbeat = ");
Serial.println (60000/inputVal);
delay(1000);
}
这是我的工作代码。我想将数据从这些传感器发送到数据库。如何使用我的代码变量做到这一点?我正在使用Node MCU作为I / O处理器。
答案 0 :(得分:0)