Skip to content

Serial client example

Fredrick Lusako Mwasekaga edited this page Aug 27, 2019 · 1 revision
//on windows, the serail stream needs to run with administrative privilages, since it needs to open a port
if(Window.IsAdministrator()){
	var stream = Stream.create({
		Address:"COM24",
		Port:115200,
		IsSerial:true,
		events : {
			onErrorReceived:function(data){
				console.log("onErrorReceived");
				console.log(data);
			},
			onDataReceived:function(data){
				console.log("onDataReceived");
				console.log(data);
			},
			onError:function(data){
				console.log("onError");
				console.log(data);
			}
		}
	});
	stream.open();
	stream.write("AT\r");
	//stream.close();
}
Clone this wiki locally