init.lua 820 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --[[ ASSUMPTIONS
  2. yorecipient.txt exists
  3. ]]
  4. DEBUG = true
  5. SETUP = false
  6. SETUP_TIMEOUT = 120000
  7. STARTUP_DELAY_TIMER = 0
  8. INTERRUPT_TIMER = 1
  9. INDEX_TIMER = 2
  10. SETUP_INACTIVITY_TIMER = 3
  11. WIFI_WAIT_TIMER = 4
  12. SUCCESS_SETUP_TIMER = 5
  13. YO_RECIPIENT = nil
  14. API_KEY = nil
  15. print("3 second startup delay using timer " .. STARTUP_DELAY_TIMER .. '...')
  16. tmr.alarm(STARTUP_DELAY_TIMER, 3000, 0, function ()
  17. print("Starting.")
  18. function debugMsg(msg)
  19. print("Yo debug: " .. msg)
  20. end
  21. -- yo recipient file must exist
  22. yoRecipientExists = file.open('yorecipient.txt', 'r')
  23. YO_RECIPIENT = file.read()
  24. file.close()
  25. debugMsg('found recipient: ' .. tostring(YO_RECIPIENT))
  26. apiKeyExists = file.open('apikey.txt', 'r')
  27. API_KEY = file.read()
  28. file.close()
  29. debugMsg('api key: ' .. API_KEY)
  30. dofile("interrupt.lua")
  31. end)