Sometimes when i upload a sketch and Data (Websocket example) with the arduino IDE it doesn’t show the website, when i copy the sketches to Visual Studio Code and upload the sketches then i can see the website?
I tried a few different esp but doesn’t make any difference
The reason i want to upload the sketch with arduino IDE is that i have to wait 5min with vsc on my computer before it’s ready
you can open the serial port of the Arduino IDE and see the messages there. maybe the board is not connected to the wifi
Omar
Hi.
That’s very weird.
Can you describe the process you follow to upload code anda data files to the board using Arduino IDE?
You’re probably missing something. Can you provide more information?
Regards,
Sara
I make a new sketch in Arduino IDE, copy the sketch from main.cpp (vsc) to the Arduino sketch. Then i make a new map data in the same map where main.cpp off the Arduino IDE is located. copy the files favicon,index,script and style into the data map of Arduino.
Then upload the data files and then upload the sketch, wait for the ip adress in the terminal, wait a few seconds and refresh the webpage
It is really strange.
I went to your tutorial of spiffs and change the main program with the code down under(the spiffs example) then it shows the index.html content. but only when i upload the files in the data folder.
When i load the sketch 1_3_HelloWorld WebServer => nothing on the webpage.
upload the files in the data folder => no result.
Change the text in the main program with the spiffs content => nothing.
Upload the files in the data folder again i can see the index.html content again.
Start your code here
#include “FS.h”
void setup() {
Serial.begin(115200);
if(!SPIFFS.begin()){
Serial.println(“An Error has occurred while mounting SPIFFS”);
return;
}
File file = SPIFFS.open(“/index.html”, “r”);
if(!file){
Serial.println(“Failed to open file for reading”);
return;
}
Serial.println();
Serial.println(“File Content:”);
while(file.available()){
Serial.write(file.read());
}
file.close();
}
void loop() {
}
That’s weird.
Probably the files in the data folder weren’t successfully uploaded. So, when you run the web server sketch, it doesn’t find any files, so it doesn’t show anything on the web server.
However, I couldn’t understand if you were able to solve the problem or not?
You are successful if you use VS Code, right?
Regards,
Sara
I think it was my day off yesterday. When i started this day more things succeeded than yesterday.
When i started up again with the first example of your course “Build Web Servers” it did work while yesterday it did not. The only thing i did different was starting up vsc and update it because he asked for updating something. Then it also uploaded the program within 2min while earlier it was 5min, wat the reason was that i wanted to use arduino IDE.
My question now is, when the main program isn’t correct and the data files are correct, is it than possible that you cann’t see the webpage?
Hi.
Yes.
If the files are successfully uploaded, but the main program doesn’t, it won’t serve the files and you won’t see the web page.
It is very weird that your VS Code is taking so long to compile. Maybe something is wrong with the installation. If you want to give it another try, I recommend that you unnistall and isntall it again.
Regards,
Sara
Oke, thanks Sara, that’s something to keep in mind that everthing should be oke to see the webpage
One thing to note with PIO. If you have libraries then PIO will compile them and cache for next use. The Arduino IDE does not. So the first time compile will be about the same time for both but subsequent PIO compiles will be much shorter.
I don’t know if that is also the case for my situation.
I just started up my laptop and uploaded the script with VS Code and it took 68sec to upload, i have seen times of 5min with the same sketch. More likely it busy on the background with other stuff i think.
What helps is do al the writing with VS Code and upload the html files with VS Code and copy paste the mainprogram to Arduino IDE and upload only the main program with Arduino