• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Problem upload sketch websocket arduino IDE not with vsc

Q&A Forum › Category: ESP8266 › Problem upload sketch websocket arduino IDE not with vsc
0 Vote Up Vote Down
Eric Roest asked 4 years ago

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

10 Answers
0 Vote Up Vote Down
omar alboug answered 4 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

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

0 Vote Up Vote Down
Eric Roest answered 4 years ago

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

0 Vote Up Vote Down
Eric Roest answered 4 years ago

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() {
}

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

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

0 Vote Up Vote Down
Eric Roest answered 4 years ago

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?

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

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

0 Vote Up Vote Down
Eric Roest answered 4 years ago

Oke, thanks Sara, that’s something to keep in mind that everthing should be oke to see the webpage
 

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

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.

0 Vote Up Vote Down
Eric Roest answered 4 years ago

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

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.