Ledger Nano X - The secure hardware wallet
SHARE
TWEET

remoteLogReceiver

kssr3951 Nov 23rd, 2014 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ===============================
  2. -- remoteLogReceiver.lua
  3. -- ===============================
  4. -- -------------------------------
  5. -- config
  6. -- -------------------------------
  7. local MODEM_DIR     = "top"
  8. local FILE_ENABLED  = true
  9. local FILE_NAME     = "remote.log"
  10. local PRINT_ENABLED = true
  11.  
  12. -- -------------------------------
  13. -- application
  14. -- -------------------------------
  15. local function debug(txt)
  16.   local hFile
  17.   if fs.exists(LOG_FILE_NAME) then
  18.     hFile = fs.open(FILE_NAME, "a");
  19.   else
  20.     hFile = fs.open(FILE_NAME, "w");
  21.   end
  22.   hFile.writeLine(txt);
  23.   hFile.close();
  24. end
  25. -- -------------------------------
  26. -- main
  27. -- -------------------------------
  28. print("log_client(remote log receiver)")
  29. print("receive() ...")
  30. while true do
  31.   rednet.open(MODEM_DIR)
  32.   local sdrId, msg, dist = rednet.receive()
  33.   rednet.close()
  34.   if PRINT_ENABLED then
  35.     print(tostring(sdrId)..","..tostring(dist)..","..msg)
  36.   end
  37.   rednet.close(MODEM_DIR)
  38. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top