-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.html
100 lines (87 loc) · 3.14 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<!--
main.html
Copyright 2018 Freie Universität Berlin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
-->
<head>
<meta charset="utf-8" />
<title>Lua-RIOT simulator</title>
<meta name="description" content="Simulate IOT devices running Lua">
<meta name="author" content="Juan I Carrano">
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<link rel="stylesheet" href="main.css" />
<script type="module" src="./node_modules/xterm/dist/xterm.js"></script>
<script type="module" src="./node_modules/fengari-web/dist/fengari-web.js"></script>
<script type="text/javascript" src="./node_modules/ace-builds/src/ace.js" ></script>
<script type="text/javascript" src="./node_modules/echarts/dist/echarts.min.js"></script>
</head>
<body>
<div id="main-pane">
<div id="code-pane">
<div id="terminal"></div>
<div id="terminal">
<form id="code-toolbar"><input id="run-btn" type="button" value="Run"></form>
</div>
<div id="editor"><div id="editor-inner">-- This is the code that will run on your device.
--[[ To change the location of the light source, run this from the terminal:
s = require"saul"
s.lsource:write(-0.5) -- you can use any other value here
]]
local s = require"saul"
local r = require"riot"
local setp = 1500
local lux = s.TSL4531:read()
local sign = 1
local increment = 10
while true do
s.Servomotor:write(setp)
r.sleep(0.02)
local lux2 = s.TSL4531:read()
if lux2 < lux then
sign = -sign
end
setp = setp + sign*increment
lux = lux2
end
</div></div>
</div>
<div id="graphs"></div></div>
</div>
<script src="piping.lua" type="application/lua" ></script>
<script src="ansicolors.lua" type="application/lua" ></script>
<script src="terminal-repl.lua" type="application/lua" ></script>
<script src="sleep.lua" type="application/lua" ></script>
<script src="saul.lua" type="application/lua" ></script>
<script src="script-control.lua" type="application/lua"></script>
<script src="chart-test.js" type="text/javascript"></script>
<script src="saul_devices.lua" type="application/lua" defer></script>
<!--
<script type="module">
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ');
term.on('data', (data) => {
term.write(data)
})
</script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/lua");
</script>
-->
</body>
</html>