Record printing temperature and humidity
-
Hi,
I am trying to edit daemon.g to make a log of a DHT22 sensor among other data. (Re: while-loop to track temperature)
I manage to create the .csv file but I always get the same error on line 5:Error: in file macro line 5 column 72: meta command: expected an expression
I am missing some number between the []?
I attach the code of my daemon.g:if !exists(global.logTemps) global logTemps = false while global.logTemps ==true && job.file.fileName != null echo >>{"0:/templog/templog.csv"} {state.time}^","^{sensors.analog[].dht22.lastReading}^","^{sensors.analog[].dht-humidity.lastReading} G4 S1
Thanks!
-
@amimafe try 0 inside the square brackets
-
Thanks for your quick response.
Daemon.g modified:
if !exists(global.logTemps) global logTemps = false while global.logTemps ==true && job.file.fileName != null echo >>{"0:/templog/templog.csv"} {state.time}^","^{sensors.analog[0].dht22.lastReading}^","^{sensors.analog[0].dht-humidity.lastReading} G4 S1
I get the following error:
Error: in file macro line 5 column 57: meta command: reached null object before end of selector string
-
@amimafe I think you need to drop the .dht22
-
Gracias por tu ayuda. Me diste una pista de cual era el fallo y finalmente lo he podido solucionar. Era un error al indicar el número de sensor que quería.
Revisé el archivo config.g y lo configuré correctamente.Declaración de los sensores en config.g:
;DHT Sensor on Temperature Daughterboard SPI CS1 pin M308 S10 P"0.spi.cs1" Y"dht22" A"Temperatura" ; define DHT22 temperature sensor M308 S11 P"S10.1" Y"dht-humidity" A"Humedad [%]" ; Attach DHT22 humidity sensor to secondary output of temperature sensor
daemon.g:
if !exists(global.logTemps) global logTemps = false while global.logTemps ==true && job.file.fileName != null echo >>{"0:/sys/templog/templog.csv"} {sensors.analog[10].lastReading}^","^{sensors.analog[11].lastReading} G4 S30
-
-