-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclock-generator.html
More file actions
86 lines (82 loc) · 3.09 KB
/
clock-generator.html
File metadata and controls
86 lines (82 loc) · 3.09 KB
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
<script type="text/javascript">
RED.nodes.registerType( 'clock-generator', {
category: 'function',
defaults: {
name: { value: '' },
topic: { value: '' },
period: { value: '1', validate: RED.validators.regex( /^[0-9]+$/ ) },
output: { value: '1' },
init: { value: false }
},
inputs: 1,
inputLabels: 'input',
outputs: 2,
outputLabels: [ 'output', 'inverted output' ],
color: '#ddab0e',
icon: 'serial.svg',
paletteLabel: 'clock generator',
label: function() {
return this.name || 'clock generator';
}
} );
</script>
<script type="text/html" data-template-name="clock-generator">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-fw fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" />
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-fw fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic" />
</div>
<br />
<div class="form-row">
<label for="node-input-period"><i class="fa fa-fw fa-repeat"></i> Period</label>
<input type="text" id="node-input-period" style="text-align: center; width: 50px;" />
<span>seconds</span>
</div>
<div class="form-row">
<label for="node-input-output"><i class="fa fa-fw fa-envelope"></i> Output</label>
<select id="node-input-output" style="width: 35%;">
<option value="1">true / false</option>
<option value="2">1 / 0</option>
</select>
</div>
<br />
<div class="form-row">
<label for="node-input-init"><i class="fa fa-fw fa-rocket"></i> Initialization</label>
<input type="checkbox" id="node-input-init" style="width: auto;" />
</div>
</script>
<script type="text/html" data-help-name="clock-generator">
<p style="text-align: justify;">
A controllable clock generator that runs through the individual clock cycles with the set
period duration.
</p>
<p style="text-align: justify;">
The clock generator starts when receiving <code>1</code> or <code>true</code> as value of
<code>msg.payload</code>. <code>0</code> or <code>false</code> as value of <code>msg.payload</code>
stops the cyclic clock output again.
</p>
<p style="text-align: justify;">
The values for <b>Name</b> and <b>Topic</b> can be set in the properties. These are also part
of an outgoing message (<code>msg.name</code> and <code>msg.topic</code>).
</p>
<p style="text-align: justify;">
Setting the <b>Period</b> value defines the length of a clock cycle. Whole seconds can be
specified here.
</p>
<p style="text-align: justify;">
The <b>Output</b> parameter specifies the data type of <code>msg.payload</code> in an outgoing
message. You can choose between <code>0</code> / <code>false</code> and <code>1</code> / <code>true</code>.
A second output delivers an inverted signal.
</p>
<p style="text-align: justify;">
If <b>Initialization</b> is set, a message with the initial payload is sent by each output
after the deploy.
</p>
<p style="text-align: justify;">
The outgoing messages also contain <code>msg.timestamp</code>, which specifies the time of
the status change in milliseconds since 1.1.1970.
</p>
</script>