How to do serial write using onclick function in html

Like we have onclick= digitalwrite(pin_number,value) is serialWrite(Tx,value) acceptable

If you see in bolt.js file
You will find a function a sendSerialData(). You can call that function on any javascript event.

function sendSerialData(serialdata) {
	var xmlhttp = new XMLHttpRequest();
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && debug == 1) {

1 Like


You dont need to specify on which pin you need to send serial data on since there is only one dedicated Tx pin on Bolt. Hence a function like serialWrite(data) would suffice. You can add one of your own by referring to the bolt.js file on bolt.

To view thw contents of the bolt.js file or to download it use the following link and replace ip with your Bolt’s ip address


Hope this clarifies your doubts