Post your best Lua script examples here

User avatar
By aventrax
#24577
Code: Select all  --DHT data acquired, process.
  for i = 1, 16, 1 do
    if (bitStream[i] > 3) then
      humidity = humidity + 2 ^ (16 - i)
    end
  end
  for i = 1, 16, 1 do
    if (bitStream[i + 16] > 3) then
      temperature = temperature + 2 ^ (16 - i)
    end
  end
  for i = 1, 8, 1 do
    if (bitStream[i + 32] > 3) then
      checksum = checksum + 2 ^ (8 - i)
    end
  end


I changed this section (4 to 3), but nothing changed.. Only testdht.lua works for me..
User avatar
By Magnus
#24587
aventrax wrote:
Code: Select all  --DHT data acquired, process.
  for i = 1, 16, 1 do
    if (bitStream[i] > 3) then
      humidity = humidity + 2 ^ (16 - i)
    end
  end
  for i = 1, 16, 1 do
    if (bitStream[i + 16] > 3) then
      temperature = temperature + 2 ^ (16 - i)
    end
  end
  for i = 1, 8, 1 do
    if (bitStream[i + 32] > 3) then
      checksum = checksum + 2 ^ (8 - i)
    end
  end


I changed this section (4 to 3), but nothing changed.. Only testdht.lua works for me..


And have you tested my suggested changes?