Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <p>Aan/Uit</p>
- <form>
- <input onclick="On()" type="button" value="On"> <input onclick="Off()" type="button" value="Off"><br>
- <br>
- </form>
- <p>Effecten</p>
- <form>
- <input onclick="Rainbow()" type="button" value="Rainbow"><input onclick="Blink()" type="button" value="Blink"><input onclick="Breath()" type="button" value="Breath"><input onclick="ColorWipe()" type="button" value="ColorWipe">
- </form>
- <p>Kleuren</p>
- <form>
- <input onclick="Rood()" type="button" value="Rood"><input onclick="Blauw()" type="button" value="Blauw"><input onclick="Rose()" type="button" value="Rose"><input onclick="Wit()" type="button" value="Wit">
- </form>
- <script type="text/javascript">
- function On() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('/0');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Off() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('=off');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Rainbow() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('/11');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Blink() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('/1');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Breath() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('/2');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function ColorWipe() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('/3');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Rood() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('*FF000D');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Blauw() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('*0800FF');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Rose() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('*FF00DC');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- function Wit() {
- var exampleSocket = new WebSocket("ws://192.168.2.53:81/");
- exampleSocket.onopen = function(event) {
- console.log('Connection Open');
- exampleSocket.send('*FFFFFF');
- };
- exampleSocket.onmessage = function(event) {
- console.log(event.data);
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment