add the beep app

This commit is contained in:
Ponali
2025-10-04 08:40:31 +02:00
parent 943f1020fa
commit 2c47a6df59
2 changed files with 25 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
local computer = require("computer")
local cliparse = require("cliparse")
cliparse.config({
["f"] = 1,
["frequency"] = 1,
["t"] = 1,
["time"] = 1,
})
local parsed, err = cliparse.parse(...)
if not parsed then
return print("\x1b[91m" .. err)
end
local freq =
tonumber(parsed.flags.f and parsed.flags.f[1] or parsed.flags.frequency and parsed.flags.frequency[1] or "440")
local time = tonumber(parsed.flags.t and parsed.flags.t[1] or parsed.flags.time and parsed.flags.time[1] or "0.1")
computer.beep(freq, time)