Last active
February 28, 2018 21:00
-
-
Save Shashi18/c14391476321fc1514da1c510a5e37ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title></title> | |
<meta name="viewport" content="width=device-width, height=device-height"> | |
<script> | |
var con; | |
function web(){ | |
con = new WebSocket('ws://192.168.1.5:81/',['arduino']); | |
con.onopen = function(event){ | |
console.log("Opened"); | |
}; | |
con.onmessage = function (evt) { | |
var received_msg = evt.data; | |
document.getElementById("message").innerHTML = evt.data; | |
}; | |
con.onclose = function(){ | |
console.log("Masakaaaa!!!"); | |
}; | |
} | |
function SwitchON() { | |
var toSend = "ON"; | |
con.send(toSend); | |
}; | |
function SwitchOFF() { | |
var toSend = "OFF"; | |
con.send(toSend); | |
}; | |
</script> | |
</head> | |
<body style="height=100% width=100%"> | |
Wemos D1 Mini SBC Bot<p></p> | |
<input type="button" onclick="SwitchON()"> Turn LED Off<p></p> | |
<input type="button" onclick="SwitchOFF()"> Turn LED On <p></p> | |
<textarea id="message"></textarea> | |
<input type="button" value="Click to Connect" onclick="web()"> | |
<input type="button" value="Click to Stop" onclick="sto()"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment