So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By darsh_t
#91047 I tried to retrieve temp and humidity from the DHT11 sensor with ESP8266. But I have been getting an error something like that "Lua error: DHT11(2).lua:4: unexpected symbol near ',' " If possible, could anyone also point out the other potential errors in this code? My code looks as follows: :D

Code: Select allpin = 1

status, temp, humi, temp_dec, humi_dec = dht.read(pin)--read dht11 from pin

if status == dht.OK then    --check status is ok and print temperature and humidity
print(string.format( "DHT Temperature:%d.%03d;Humidity:%d.%03d" )
math.floor(temp),
temp_dec,
math.floor(humi),
humi_dec
    )
elseif status == dht.ERROR_CHECKSUM then    --else print either status
print( "DHT Checksum error." )
elseif status == dht.ERROR_TIMEOUT then
print( "DHT timed out." )
end