Bonjour
http://oct1.oct2.oct3.oct4/arduino/digital/.../...:5555
J'envoie (pas représenté dans ce code minimaliste) sans problème des infos
depuis un navigateur distant vers mon petit serveur se trouvant
dans le YUN.
Le serveur renvoie sans problème des infos vers
le navigateur (ici on se contente de renvoyer <h1>TOTO</h1> ) mais...
le code HTML n'est jamais interprété par le navigateur !!
Je tiens à dire que j'ai fait pas mal de recherches à ce sujet avant de poster
mais je suis très très débutant et ça limite mes possibilités !
Je vous transmets donc ce code très SIMPLE qui ne traite que de la
partie du travail qui ne fonctionne pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 #include <Bridge.h> #include <BridgeServer.h> #include <BridgeClient.h> BridgeServer server; // le webserver écoute le port 5555 (par défaut) void setup() { Serial.begin(9600); while(!Serial) { } Bridge.begin(); server.noListenOnLocalhost(); server.begin(); Serial.println("Prêt !!"); } void loop() { BridgeClient client = server.accept(); if ( client ) { Serial.println("new client"); String command = client.readStringUntil('/'); Serial.println(command); client.println("HTTP/1.1 200 OK"); client.println("Transfer-Encoding: chunked"); client.println("Content-Type: text/html; charset=UTF-8"); client.println("Connection: close"); client.println(); client.println("<!DOCTYPE html>"); client.println("<html>"); client.println("<head><title>Arduino YUN</title></head>"); client.println("<body><h1>TOTO</h1></body></html>"); } // give the web browser time to receive the data delay(1); // close the connection: client.stop(); }
windows 10 et Yun, port série COM7
J'imagine que c'est une question de cours mais je ne trouve pas !
Merci à tous
Pierregrenoble
Partager