J'ai un problème lorsque je compile mon programme qui utilise la librairie RF12.
En fait le programme se compile très bien au lycée mais lorsque je veux le compiler chez moi il me dis "RF12_initialize ... was not declared in this scope " en gros un problème de librairie . Le pire c'est qu'on utilise exactement la même qu'au lycée, on a copié collé tout le fichier librairie mais rien n'y fait le programme ce compile que sur un seul ordinateur !
Pourquoi ? =(
#include <Arduino.h>
#include <RF12.h>
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
#define CRC_POLY 0x31
#define MAX_SENSORS 8
#define DEBUG_OFF
//#define DEBUG
#define REQ_BUF_SZ 50 // taille du buffer utilisé pour capturer les requêtes HTTP
struct Sensor {
byte sensorId;
byte temp;
byte decimalTemp;
byte hygro;
byte resetFlag;
byte weakBatt;
};
Sensor sensors[MAX_SENSORS];
// Adresses du shield Ethernet
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x9D, 0xD2 }; // adresse MAC
IPAddress ip(192, 168, 5, 228); // adresse IP
EthernetServer server(80); // créé un serveur au port 80
File webFile; // le fichier de la page web sur la carte SD
char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP request stored as null terminated string
char req_index = 0; // index into HTTP_req buffer
/*------------------------------------------------------------------------------------SETUP----------------------------------------------------------------------------------*/
void setup()
{
Serial.begin(9600); // initialisation du moniteur série
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
Serial.println("Initialisation de la carte SD...");
if (!SD.begin(4)) {
Serial.println("ERREUR - Initialisation de la carte SD impossible!"); // initialisation ratée
return;
}
Serial.println("OK - Carte SD initialisee.");
Serial.println("");
Serial.println("SUCCESS - SD card initialized.");
// check for index.htm file
if (!SD.exists("index.htm")) {
Serial.println("ERROR - Can't find index.htm file!");
return; // can't find index file
}
Serial.println("SUCCESS - Found index.htm file.");
Ethernet.begin(mac, ip); // initialisation Ethernet
server.begin(); // start to listen for clients
// Overide settings for RFM01/IT+ compliance
rf12_initialize(1, RF12_868MHZ, 0xd4);
rf12_initialize_overide_ITP();
#ifdef DEBUG
Serial.println("Initialisation du RF12...");
Serial.println("OK - RF12 initialise.");
Serial.println("");
#endif
}
/*------------------------------------------------------------------------------------LOOP----------------------------------------------------------------------------------*/
void loop()
{
delay(500);
EthernetClient client = server.available(); // try to get client
if (client) { // got client?
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) { // client data available to read
char c = client.read(); // read 1 byte (character) from client
// buffer first part of HTTP request in HTTP_req array (string)
// leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)
if (req_index < (REQ_BUF_SZ - 1)) {
HTTP_req[req_index] = c; // save HTTP request character
req_index++;
}
// last line of client request is blank and ends with \n
// respond to client only after last line received
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
// remainder of header follows below, depending on if
// web page or XML page is requested
// Ajax request - send XML file
if (StrContains(HTTP_req, "ajax_inputs")) {
// send rest of HTTP header
client.println("Content-Type: text/xml");
client.println("Connection: keep-alive");
client.println();
// send XML file containing input states
XML_response(client);
webFile = SD.open("index.htm");
}
else if (StrContains(HTTP_req, "GET /nuage.png")) {
webFile = SD.open("nuage.png");
if (webFile) {
client.println("HTTP/1.1 200 OK");
client.println();
}
else { // web page request
// send rest of HTTP header
client.println("Content-Type: text/html");
client.println("Connection: keep-alive");
client.println();
// send web page
webFile = SD.open("index.htm"); // open web page file
delay(1000);//debug
Serial.println (webFile);//debug
if (webFile) {
Serial.println ("index.htm ouvert");//debug
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
}
// display received HTTP request on serial port
Serial.print(HTTP_req);
// reset buffer index and all buffer elements to 0
req_index = 0;
StrClear(HTTP_req, REQ_BUF_SZ);
break;
}
// every line of text received from the client ends with \r\n
if (c == '\n') {
// last character on line of received text
// starting new line with next character read
currentLineIsBlank = true;
}
else if (c != '\r') {
// a text character was received from client
currentLineIsBlank = false;
}
} // end if (client.available())
} // end while (client.connected())
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection
} // end if (client)
}
Ganew:
Et Uzuma la librairie est bien installé comme je l'ai dis j'ai tout mis comme l'autre ordi
Il vient peut être de là le problème car ça m'étonnerais que "l*'ordi de chez toi soit identique à celui du lycée*"
L'erreur renvoyée vient du fait que ta libraire est pas trouvée, soit tu ne l'a pas mise au bon endroit, soit tu en as deux identiques mais il y a quelque chose qui ne va pas de ce côté, c'est sur.
John j'ai prit le fichier arduino complet sur l'ordi ou ca marche et je l'ai collé sur le mien don aucune raison et ca sur n'importe quel ordinateur on a essayer au lycée sur d'autre ordi et ça ne marche pas non plus...
Je viens de compiler ton programme avec la bibliothèque installer et effectivement il y a un problème à ce niveau.
Ce que je peux dire c'est qu'il doit y avoir un fichier installer sur l'autre ordinateur mais qui ne l'est pas sur le tient.
'rf12_initialize_overide_ITP' was not declared in this scope
programme_final.ino : in function 'void setup() ' :
programme_final:65 error 'rf12_initialize_overide_ITP' was not declared in this scope
programme_final.ino: In function 'void loop()':
programme_final:171: error: a function-definition is not allowed here before '{' token
Tu as installé quelle version de l'IDE Arduino ?
Car il y a des petits trucs qui changent, comme par exemple des librairies automatiquement dans le pack ou pas.
Effectivement j'ai du la coupé en copiant le programme et en effet le problème viens d'abord du voidsetup : 'rf12_initialize_overide_ITP' was not declared in this scope