Nuker57

More Advanced Timer Loop Computercraft

May 13th, 2021
842
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main()
  2.     --richiedo i valori
  3.     print("Inserire l'intervallo: [float]")
  4.     intervallo = read()
  5.     print('Inserire il lato: [str]')
  6.     side = read()
  7.     --apro e scrivo il programma
  8.     file = io.open("startup","w")
  9.  
  10.     file:write(
  11.     'lato = '..side..'\n' ..
  12.     'Durata = 0.05\n' ..
  13.     'Intervallo = '..intervallo..'\n' ..
  14.     'while true do\n' ..
  15.     '\trs.setOutput(lato, true)\n' ..
  16.     '\tsleep(Durata)\n' ..
  17.     '\trs.setOutput(lato, false)\n' ..
  18.     '\tsleep(Intervallo)\n' ..
  19.     'end'
  20.     )
  21.    
  22.     file:close()
  23.     print('Setup completed! Rebooting...')
  24.     sleep(1)
  25.     os.reboot()
  26. end
  27.  
  28. main()
RAW Paste Data