Change time delay and output format

This commit is contained in:
coolneng 2023-03-15 04:20:59 +01:00
parent 89b3ec1889
commit 1853ecca00
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 3 additions and 3 deletions

View File

@ -15,11 +15,11 @@ void setup() {
} }
void loop() { void loop() {
char buffer[100]; char buffer[200];
int analog_val = analogRead(fc28_pin); int analog_val = analogRead(fc28_pin);
int soil_percentage = map(analog_val, 0, 1023, 0, 100); int soil_percentage = map(analog_val, 0, 1023, 0, 100);
sprintf(buffer, "Temperature: %.2f °C Humidity: %.2f %% Soil humidity: %i %%", sprintf(buffer, "Temperature: %.2f°C Humidity: %.2f%% Soil humidity: %i%%",
dht.readTemperature(), dht.readHumidity(), soil_percentage); dht.readTemperature(), dht.readHumidity(), soil_percentage);
Serial.println(buffer); Serial.println(buffer);
delay(60000); delay(30000);
} }