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,15 +11,9 @@ | ||
11 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); | 11 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); |
12 | websocket.onerror=function(){ $('h1').css('color','red');}; | 12 | websocket.onerror=function(){ $('h1').css('color','red');}; |
13 | websocket.onopen=function(){ $('h1').css('color','green');}; | 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 | </script> | 19 | </script> |
@@ -43,5 +37,7 @@ | @@ -43,5 +37,7 @@ | ||
43 | <span class="onoffswitch-switch"></span> | 37 | <span class="onoffswitch-switch"></span> |
44 | </label> | 38 | </label> |
45 | </div> | 39 | </div> |
40 | + <button onclick="sendMessage();">Send</button> | ||
41 | + <div id="messages"></div> | ||
46 | </body> | 42 | </body> |
47 | </html> | 43 | </html> |
pageHTML/couleur.html
@@ -10,20 +10,11 @@ | @@ -10,20 +10,11 @@ | ||
10 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); | 10 | var websocket = new WebSocket('ws://192.168.43.222:9000', 'myprotocol'); |
11 | websocket.onerror=function(){ $('h1').css('color','red');}; | 11 | websocket.onerror=function(){ $('h1').css('color','red');}; |
12 | websocket.onopen=function(){ $('h1').css('color','green');}; | 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 | </script> | 19 | </script> |
29 | 20 | ||
@@ -48,6 +39,8 @@ | @@ -48,6 +39,8 @@ | ||
48 | <span class = "highlight"></span> | 39 | <span class = "highlight"></span> |
49 | <output id="rangevalue2">50</output> | 40 | <output id="rangevalue2">50</output> |
50 | </div> | 41 | </div> |
42 | + <button onclick="sendMessage();">Send</button> | ||
43 | + <div id="messages"></div> | ||
51 | <h4><a href="Menu.html">Retour</a></h4> | 44 | <h4><a href="Menu.html">Retour</a></h4> |
52 | </body> | 45 | </body> |
53 | </html> | 46 | </html> |
pageHTML/intensite.html
@@ -11,11 +11,6 @@ | @@ -11,11 +11,6 @@ | ||
11 | websocket.onerror=function(){ $('h1').css('color','red');}; | 11 | websocket.onerror=function(){ $('h1').css('color','red');}; |
12 | websocket.onopen=function(){ $('h1').css('color','green');}; | 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 | function sendMessage(){ | 15 | function sendMessage(){ |
21 | websocket.send($('#message').val()); | 16 | websocket.send($('#message').val()); |
@@ -25,7 +20,8 @@ | @@ -25,7 +20,8 @@ | ||
25 | 20 | ||
26 | </head> | 21 | </head> |
27 | <body> | 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 | <input type="text" id="message"/> | 25 | <input type="text" id="message"/> |
30 | <!-- le bouton pour envoyer lemessage --> | 26 | <!-- le bouton pour envoyer lemessage --> |
31 | <button onclick="sendMessage();">Send</button> | 27 | <button onclick="sendMessage();">Send</button> |