Boa tarde galera, tudo na paz?

Estou com um problema no meu projeto, resumindo meu projeto com arduino.

- Arduino UNO

- Webserver criado no EthernetShield W5100

- SD card ( pastas do projeto criadas no cartão sd )

   

( esta é a estrutura do meu cartão sd )

- Inicializo o webserver e abre a pagina principal normalmente, mas as chamdas js e os scripts não funcionam, não entendo bem como as chamdas acontecem, mas clico no botão na pagina principal, vejo o link da seguinte forma " 192.168.0.100/painel.html " mas não abre !!.  a página principal é da seguinte forma:

colocarei meu código do Arduíno aqui :

#################################################################################

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 100); // IP address, may need to change depending on network
EthernetServer server(80); // create a server at port 80

File webFile;

void setup()
{
Ethernet.begin(mac, ip); // initialize Ethernet device
server.begin(); // start to listen for clients
Serial.begin(9600); // for debugging

// initialize SD card
Serial.println("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("ERROR - SD card initialization failed!");
return; // init failed
}
Serial.println("SUCCESS - SD card initialized.");

if (!SD.exists("setup.htm")) {
Serial.println("ERRO -Setup.htm não encontrado!");
return; // can't find index file
}
Serial.println("SUCCESS - Found index.htm file.");
}

void loop()
{
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
// 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");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
// send web page
webFile = SD.open("setup.htm"); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
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)
}

#################################################################################

Não sei como que faço para carregar a página " painel.html " por exemplo ?, só abre a bendita da página " setup.htm", rsrsrs.

Grato à todos que chegaram até aqui.

Neil Bueno

Exibições: 556

Responder esta

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço