-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton_Press_Count.html
More file actions
29 lines (26 loc) · 931 Bytes
/
Button_Press_Count.html
File metadata and controls
29 lines (26 loc) · 931 Bytes
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Button Press Count</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://webduino.io/components/webduino-js/dist/webduino-all.min.js"></script>
<script src="https://blockly.webduino.io/webduino-blockly.js"></script>
<script src="https://blockly.webduino.io/lib/runtime.min.js"></script>
</head>
<body>
<h1 id="show">123</h1>
<script>
var button, count = 0;
var show = document.getElementById("show");
boardReady({device: 'kzpV'}, board => {
board.systemReset();
board.samplingInterval = 250;
button = getButton(board, 11);
show.innerHTML = 0;
button.on("pressed", () => show.innerHTML = count++);
button.on("longPress", () => show.innerHTML = count = 0);
});
</script>
</body>