mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	serial control
This commit is contained in:
		@@ -57,7 +57,7 @@ Send the request message in `msg.payload` as you would do with a serial out node
 | 
				
			|||||||
For consistency with the serial in node, msg.port is also set to the name of the port selected.
 | 
					For consistency with the serial in node, msg.port is also set to the name of the port selected.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Serial Control
 | 
					### Serial Control
 | 
				
			||||||
When you start the node-red, the flow(program) picks up the pre-programmed serial port, open it, and start the communication. But there are some cases the port needs to switch to a different port, stop, and start again. For example, in order to upload a new binary for Arduino, the serial port needs to be stopped relased from the nodered, and start it again after uploading. Or when the FTDI device re-connects after disconnected for any reason, it may be possible the port number change, and the end user of the flow can't change the port.
 | 
					When the node-red starts, the flow(program) picks up the pre-programmed serial port, open it, and start the communication. But there are some cases the port needs to switch to a different port, stop, and start again. For example, in order to upload a new binary for Arduino, the serial port needs to be stopped relased from the nodered, and start it again after uploading. Or when the FTDI device re-connects after disconnected for any reason, it may be possible the port number change, and the end user of the flow can't change the port.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This `Serial Control` node provides the serial port control capability to 
 | 
					This `Serial Control` node provides the serial port control capability to 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,3 +93,46 @@
 | 
				
			|||||||
    <p>Optionally the new line character used to split the input
 | 
					    <p>Optionally the new line character used to split the input
 | 
				
			||||||
       can be appended to every message sent out to the serial port.</p>
 | 
					       can be appended to every message sent out to the serial port.</p>
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script type="text/html" data-help-name="serial control">
 | 
				
			||||||
 | 
					    <p>Stops, starts the serial communication and controls the serial port configuration.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <p>This node provides the serial port control capability to</p>
 | 
				
			||||||
 | 
					    <ul>
 | 
				
			||||||
 | 
					        <li>stop the communication and releasing the serial port so, for example the Arduino can upload the new binary without shutting down the nodered.</li>
 | 
				
			||||||
 | 
					        <li>start the communication after stopped with this `Serial Control` node for above reason or the like.</li>
 | 
				
			||||||
 | 
					        <li>change the serial port and the configuration on the run time programatically.</li>
 | 
				
			||||||
 | 
					        <li>query the serial port configuration.</li>
 | 
				
			||||||
 | 
					    </ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <h3>Inputs</h3>
 | 
				
			||||||
 | 
					        <p>In order to control the communication, just send these JSON messages to the control node.</p>
 | 
				
			||||||
 | 
					        <ul>
 | 
				
			||||||
 | 
					            <li>
 | 
				
			||||||
 | 
					                <code>{ "stop":"" }</code> stops the communication
 | 
				
			||||||
 | 
					            </li>
 | 
				
			||||||
 | 
					            <li>
 | 
				
			||||||
 | 
					            <code>{ "stop":"" }</code> starts the communication
 | 
				
			||||||
 | 
					            </li>
 | 
				
			||||||
 | 
					            <li>
 | 
				
			||||||
 | 
					                <code> {
 | 
				
			||||||
 | 
					                "config" : {
 | 
				
			||||||
 | 
					                    "newport": "/dev/tty.usbmodem1234561",
 | 
				
			||||||
 | 
					                    "serialbaud": 115200,
 | 
				
			||||||
 | 
					                    "databits": 8,
 | 
				
			||||||
 | 
					                    "parity": "none",
 | 
				
			||||||
 | 
					                    "stopbits": 1
 | 
				
			||||||
 | 
					                } 
 | 
				
			||||||
 | 
					            }      
 | 
				
			||||||
 | 
					                </code> changes the serial port and the configuration on the fly. the <code>newport</code> is the mandatory field.
 | 
				
			||||||
 | 
					            </li>
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            <li>
 | 
				
			||||||
 | 
					                <code>{ "config":"query" }</code> querys the serial port configuration and returns the result in the <code>msg.payload</code>
 | 
				
			||||||
 | 
					            </li>
 | 
				
			||||||
 | 
					        </ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <h3>Outputs</h3>
 | 
				
			||||||
 | 
					    <p><code>msg.payload</code> is the response. It contains the serial port configuration</p>
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user