0
我想通过串行将数据从arduino发送到计算机。然后我想记录基于当前时间戳的时间,并将其保存在txt文件中。我该怎么办?你的建议对我非常有用。从arduino读取数据并添加时间戳
上的Arduino这是我的代码:
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup(){
Serial.begin(9600);
dht.begin();
}
void loop(){
float hum = dht.readHumidity();
float temp= dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
delay(2000);
}
你接收数据通过串行端口在电脑上?你的Python代码在哪里读取? – stevieb