summaryrefslogtreecommitdiffstats
path: root/examples/scripts/simple/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'examples/scripts/simple/index.html')
-rw-r--r--examples/scripts/simple/index.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/examples/scripts/simple/index.html b/examples/scripts/simple/index.html
new file mode 100644
index 0000000..516ecbe
--- /dev/null
+++ b/examples/scripts/simple/index.html
@@ -0,0 +1,68 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="viewport" content = "height = device-height, width = 420, user-scalable = no" />
6 <title>WebIOPi | Demo</title>
7 <script type="text/javascript" src="/webiopi.js"></script>
8 <script type="text/javascript">
9 webiopi().ready(function() {
10 webiopi().setFunction(25, "out");
11
12 var content, button;
13 content = $("#content");
14
15 // create a "LED" labeled button for GPIO 25
16 button = webiopi().createGPIOButton(25, "LED1");
17 content.append(button); // append button to content div
18
19 // create a button that output a single pulse
20 button = webiopi().createPulseButton("pulse", "Pulse", 25);
21 content.append(button); // append button to content div
22
23 // you can also create a button which calls a different function for mouse down and up events
24 button = webiopi().createButton("hold", "Hold", mousedown, mouseup);
25 content.append(button);
26
27 webiopi().refreshGPIO(true);
28 });
29
30 function mousedown() {
31 webiopi().digitalWrite(25, 1);
32 }
33
34 function mouseup() {
35 webiopi().digitalWrite(25, 0);
36 }
37
38 </script>
39 <style type="text/css">
40 button {
41 display: block;
42 margin: 5px 5px 5px 5px;
43 width: 160px;
44 height: 45px;
45 font-size: 24pt;
46 font-weight: bold;
47 color: black;
48 }
49
50 input[type="range"] {
51 display: block;
52 width: 160px;
53 height: 45px;
54 }
55
56 .LOW {
57 background-color: White;
58 }
59
60 .HIGH {
61 background-color: Red;
62 }
63 </style>
64</head>
65<body>
66 <div id="content" align="center"></div>
67</body>
68</html>