Commit f95be3d3d7ae35d295946879c1a3b85bad3dbdeb
1 parent
3e26b079
envoie donnée intensité + couleur ok. Pb Menu et mode valeur toujours false
Showing
3 changed files
with
13 additions
and
28 deletions
Show diff stats
pageHTML/Menu.html
... | ... | @@ -11,15 +11,9 @@ |
11 | 11 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); |
12 | 12 | websocket.onerror=function(){ $('h1').css('color','red');}; |
13 | 13 | websocket.onopen=function(){ $('h1').css('color','green');}; |
14 | - | |
15 | - webscket.onmessage=function(message){ | |
16 | - console.log(message.data); | |
17 | - $('#messages').append($('<p>',{ text: message.data})); | |
18 | - }; | |
19 | - | |
20 | - function etat(){ | |
21 | - var message=$('#myonoffswitch').checked; | |
22 | - websocket.send(message); | |
14 | + | |
15 | + function sendMessage(){ | |
16 | + websocket.send($('#onoffswitch').is(':checked')); | |
23 | 17 | } |
24 | 18 | |
25 | 19 | </script> |
... | ... | @@ -43,5 +37,7 @@ |
43 | 37 | <span class="onoffswitch-switch"></span> |
44 | 38 | </label> |
45 | 39 | </div> |
40 | + <button onclick="sendMessage();">Send</button> | |
41 | + <div id="messages"></div> | |
46 | 42 | </body> |
47 | 43 | </html> | ... | ... |
pageHTML/couleur.html
... | ... | @@ -10,20 +10,11 @@ |
10 | 10 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); |
11 | 11 | websocket.onerror=function(){ $('h1').css('color','red');}; |
12 | 12 | websocket.onopen=function(){ $('h1').css('color','green');}; |
13 | - | |
14 | - | |
15 | - webscket.onmessage=function(message){ | |
16 | - console.log(message.data); | |
17 | - $('#messages').append($('<p>',{ text: message.data})); | |
18 | - }; | |
19 | 13 | |
20 | - function couleur(){ | |
21 | - var rouge=$('#slider').value(); | |
22 | - var vert=$('#slider1').value(); | |
23 | - var bleu=$('#slider2').value(); | |
24 | - websocket.send(rouge); | |
25 | - websocket.send(vert); | |
26 | - websocket.send(bleu); | |
14 | + function sendMessage(){ | |
15 | + websocket.send($('#rangevalue').val()); | |
16 | + websocket.send($('#rangevalue1').val()); | |
17 | + websocket.send($('#rangevalue2').val()); | |
27 | 18 | } |
28 | 19 | </script> |
29 | 20 | |
... | ... | @@ -48,6 +39,8 @@ |
48 | 39 | <span class = "highlight"></span> |
49 | 40 | <output id="rangevalue2">50</output> |
50 | 41 | </div> |
42 | + <button onclick="sendMessage();">Send</button> | |
43 | + <div id="messages"></div> | |
51 | 44 | <h4><a href="Menu.html">Retour</a></h4> |
52 | 45 | </body> |
53 | 46 | </html> | ... | ... |
pageHTML/intensite.html
... | ... | @@ -11,11 +11,6 @@ |
11 | 11 | websocket.onerror=function(){ $('h1').css('color','red');}; |
12 | 12 | websocket.onopen=function(){ $('h1').css('color','green');}; |
13 | 13 | |
14 | - | |
15 | - webscket.onmessage=function(message){ | |
16 | - console.log(message.data); | |
17 | - $('#messages').append($('<p>',{ text: message.data})); | |
18 | - }; | |
19 | 14 | |
20 | 15 | function sendMessage(){ |
21 | 16 | websocket.send($('#message').val()); |
... | ... | @@ -25,7 +20,8 @@ |
25 | 20 | |
26 | 21 | </head> |
27 | 22 | <body> |
28 | -<h1>Changement d'intensite de votre veilleuse connectée</h1> | |
23 | + <h1>Changement d'intensite de votre veilleuse connectée</h1> | |
24 | + <p>Veuillez entrer une valeur entre 0 et 255 </p> | |
29 | 25 | <input type="text" id="message"/> |
30 | 26 | <!-- le bouton pour envoyer lemessage --> |
31 | 27 | <button onclick="sendMessage();">Send</button> | ... | ... |