summaryrefslogtreecommitdiff
path: root/temt6000.lua
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-01-14 11:37:11 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-01-14 11:37:11 +0100
commit7724c18277bc21e8d55f3ff0bf015cd5409607fa (patch)
treed81777e63bd1cca7f150c8985bdb712520d6228c /temt6000.lua
Initial commit
Diffstat (limited to 'temt6000.lua')
-rw-r--r--temt6000.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/temt6000.lua b/temt6000.lua
new file mode 100644
index 0000000..472148c
--- /dev/null
+++ b/temt6000.lua
@@ -0,0 +1,17 @@
+local temt6000 = {}
+
+function temt6000.read()
+ local raw = adc.read(0)
+ if raw < 70 then
+ return raw
+ end
+ if raw == 1024 then
+ return 2500, raw
+ end
+ if raw < 300 then
+ return (raw-70) * 2, raw
+ end
+ return raw * 2, raw
+end
+
+return temt6000