-- LuaPaste by RoboRemo function writeFile(fileName) file.remove(fileName) file.open(fileName, "w+") print("file "..fileName.." opened") fileData = "" uart.on("data", 0, function(a) fileData = fileData .. a tmr.stop(0) tmr.alarm(0,500,0,function() file.write(fileData) file.close() print("file closed") uart.on("data") end) end, 0) end print("enter file name") uart.on("data", "\n", function(a) writeFile( string.sub(a,1,string.len(a)-1) ) end, 0)