Bonjour,
je veux installer un module EsP8862 avec ma carte arduino mega mais j'ai des erreurs pendant la compilation
voici le code que j'utilise
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 #include <SoftwareSerial.h> SoftwareSerial ESP8266(10, 11); String NomduReseauWifi = "Entrez le nom de votre Box ou point d'accès Wifi"; // Garder les guillements String MotDePasse = "Entrez le nom du mot de passe de votre Box ou point d'accès Wifi"; // Garder les guillements /****************************************************************/ /* INIT */ /****************************************************************/ void setup() { Serial.begin(9600); ESP8266.begin(9600); initESP8266(); } /****************************************************************/ /* BOUCLE INFINIE */ /****************************************************************/ void loop() { while(ESP8266.available()) { Serial.println(ESP8266.readString()); } } /****************************************************************/ /* Fonction qui initialise l'ESP8266 */ /****************************************************************/ void initESP8266() { Serial.println("**********************************************************"); Serial.println("**************** DEBUT DE L'INITIALISATION ***************"); Serial.println("**********************************************************"); envoieAuESP8266("AT+RST"); recoitDuESP8266(2000); Serial.println("**********************************************************"); envoieAuESP8266("AT+CWMODE=3"); recoitDuESP8266(5000); Serial.println("**********************************************************"); envoieAuESP8266("AT+CWJAP=\""+ NomduReseauWifi + "\",\"" + MotDePasse +"\""); recoitDuESP8266(10000); Serial.println("**********************************************************"); envoieAuESP8266("AT+CIFSR"); recoitDuESP8266(1000); Serial.println("**********************************************************"); envoieAuESP8266("AT+CIPMUX=1"); recoitDuESP8266(1000); Serial.println("**********************************************************"); envoieAuESP8266("AT+CIPSERVER=1,80"); recoitDuESP8266(1000); Serial.println("**********************************************************"); Serial.println("***************** INITIALISATION TERMINEE ****************"); Serial.println("**********************************************************"); Serial.println(""); } /****************************************************************/ /* Fonction qui envoie une commande à l'ESP8266 */ /****************************************************************/ void envoieAuESP8266(String commande) { ESP8266.println(commande); } /****************************************************************/ /*Fonction qui lit et affiche les messages envoyés par l'ESP8266*/ /****************************************************************/ void recoitDuESP8266(const int timeout) { String reponse = ""; long int time = millis(); while( (time+timeout) > millis()) { while(ESP8266.available()) { char c = ESP8266.read(); reponse+=c; } } Serial.print(reponse); }
Et voici le message d'erreur:
et aussi j'ai un autre problème : je peux pas taper des commandes AT sur le moniteur serieArduino : 1.8.5 (Windows 7), Carte : "Generic ESP8266 Module, 80 MHz, ck, 26 MHz, 40MHz, QIO, 512K (no SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 9600"
<command-line>:0:9: error: expected unqualified-id before numeric constant
C:\Users\moi\Documents\Arduino\sketch_jan25b\sketch_jan25b.ino:3:16: note: in expansion of macro 'ESP8266'
SoftwareSerial ESP8266(10, 11);
^
C:\Users\moi\Documents\Arduino\sketch_jan25b\sketch_jan25b.ino: In function 'void setup()':
sketch_jan25b:14: error: request for member 'begin' in '1', which is of non-class type 'int'
ESP8266.begin(9600);
^
C:\Users\moi\Documents\Arduino\sketch_jan25b\sketch_jan25b.ino: In function 'void loop()':
sketch_jan25b:22: error: request for member 'available' in '1', which is of non-class type 'int'
while(ESP8266.available())
^
sketch_jan25b:24: error: request for member 'readString' in '1', which is of non-class type 'int'
Serial.println(ESP8266.readString());
^
C:\Users\moi\Documents\Arduino\sketch_jan25b\sketch_jan25b.ino: In function 'void envoieAuESP8266(String)':
sketch_jan25b:63: error: request for member 'println' in '1', which is of non-class type 'int'
ESP8266.println(commande);
^
C:\Users\moi\Documents\Arduino\sketch_jan25b\sketch_jan25b.ino: In function 'void recoitDuESP8266(int)':
sketch_jan25b:74: error: request for member 'available' in '1', which is of non-class type 'int'
while(ESP8266.available())
^
sketch_jan25b:76: error: request for member 'read' in '1', which is of non-class type 'int'
char c = ESP8266.read();
^
exit status 1
request for member 'begin' in '1', which is of non-class type 'int'
Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences
Partager