Community
cancel
Showing results for 
Search instead for 
Did you mean: 
wcaro
New Contributor I
1,436 Views

i need reading an index.html in the Galilean intel sd for web server?

I need to read the index.html and send it to the client

something like that:

file= fopen("/media/realroot/index.htm" , "r");

client.write( file ); // send web page to client

The example below is with external sd, but I need the same but with the sd where Linux is installed

}

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

if (webFile) {

while(webFile.available()) {

client.write(webFile.read()); // send web page to client

}

webFile.close();

}

thanks for the help you can give me

3 Replies
Pedro_M_Intel
Employee
72 Views

Hello wilson caro,

I'm sorry; I'm a little confused by your post. Specifically with the following sentence:

"...The example below is with external SD, but I need the same but with the SD where Linux is installed..."

I mean, when you are using Galileo with the full Yocto image installed on an SD Card, you can also use it as an external massive storage device which is in fact found in /media/realroot.

Now, how do you want to send the file to your client? Which interface will you be using?

What is your client? Is it another board, a PC, etc.? You are using the Arduino IDE for this project, right?

Peter.

wcaro
New Contributor I
72 Views

thanks for the reply, and excuse my English, I speak Spanish or Italian.

I want is to use the example of the web server, but do not want the website within the sketch, as is normally done. example:

// 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();

client.println("<!DOCTYPE HTML>");

client.println("");

// add a meta refresh tag, so the browser pulls again every 5 seconds:

client.println("");

// output the value of each analog input pin

for (int analogChannel = 0; analogChannel < 6; analogChannel++) {

int sensorReading = analogRead(analogChannel);

client.print("analog input ");

client.print(analogChannel);

client.print(" is ");

client.print(sensorReading);

client.println("");

I want to read the index.html copied into the sd "intel Galieo gene 2" and send it. The following is an example with Arduino Mega or one. external SD module has not integrated, as in the Galilean intel.

}

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

if (webFile) {

while(webFile.available()) {

client.write(webFile.read()); // send web page to client

}

webFile.close();

}

the following link is an example of what I want. but I want to do with the "Galilean intel gene 2".

https://startingelectronics.org/projects/arduino-projects/web-server-two-temperature-gauges/ https://startingelectronics.org/projects/arduino-projects/web-server-two-temperature-gauges/

thanks for the help.

Pedro_M_Intel
Employee
72 Views

I see, in that case, wouldn't a sketch such as 'ReadWrite.ino' (found in the example>SD section of the Arduino IDE) help? I mean, you can adapt it to your own sketch and use it to read the html file found in the Galileo's SD, then you can create the web server using that file.

Since you are trying to interact with the file system, there is a blog written by mhahn that you might find of interest: https://software.intel.com/en-us/blogs/2014/09/22/efficient-communication-between-arduino-and-linux-... Efficient communication between Arduino* and Linux native processes. I suggest you to take a look at it, it may help you in this or future projects.

Peter.

Reply