mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add byte mode and mouse buttons to Pi node
This commit is contained in:
@@ -288,3 +288,47 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-template-name="rpi-mouse">
|
||||
<div class="form-row">
|
||||
<label for="node-input-butt"><i class="fa fa-circle"></i> Button</label>
|
||||
<select type="text" id="node-input-butt" style="width: 250px;">
|
||||
<option value="1">left</option>
|
||||
<option value="2">right</option>
|
||||
<option value="4">middle</option>
|
||||
<option value="7">any</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="rpi-mouse">
|
||||
<p>Raspberry Pi mouse button node. Generates a <b>msg.payload</b> with
|
||||
either a 1 or 0 when the selected mouse button is pressed and released</p>
|
||||
<p>Also sets <b>msg.button</b> to the code value, 1 = left, 2 = right, 4 = middle,
|
||||
so you can work out which button or combination was pressed.</p>
|
||||
<p>And sets <b>msg.topic</b> to <i>pi/mouse</i>.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('rpi-mouse',{
|
||||
category: 'Raspberry Pi',
|
||||
color:"#c6dbef",
|
||||
defaults: {
|
||||
name: { value:"" },
|
||||
butt: { value:"1",required:true }
|
||||
},
|
||||
inputs:0,
|
||||
outputs:1,
|
||||
icon: "rpi.png",
|
||||
label: function() {
|
||||
return this.name||"Pi Mouse" ;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user