From 76e5aa7148ff6845a45b3594ae0048190ce67cf4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 20 Jun 2023 04:18:46 -0700 Subject: [PATCH] Res: Add demo light sensor script --- res/scripts/light-oscillate.lua | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 res/scripts/light-oscillate.lua diff --git a/res/scripts/light-oscillate.lua b/res/scripts/light-oscillate.lua new file mode 100644 index 000000000..6a2848842 --- /dev/null +++ b/res/scripts/light-oscillate.lua @@ -0,0 +1,8 @@ +local theta = 0 + +function readLight() + theta = math.fmod(theta + math.pi / 120, math.pi * 2) + return (math.sin(theta) + 1) * 75 +end + +emu:setSolarSensorCallback(readLight)