I tried to make a web server for my website.
I use a Arduino Uno, a Ethernet Shield, and a Samsung EVO 64 GB micro SD card.
The problem is that when I open it on my browser (I type in 192.168.1.20), It's empty.
There's definitely a website there.
When I check my serial monitor, it said: Initializing SD card... ERROR - SD card initialization failed!
Here's the code:
So move the SD initialization code to above the Ethernet initialization code.
First, I moved the SD initialization to the top.
Then, I see some bugs, such as incorrect file name.
The problem is that there's an error: Arduino: 1.8.7 (Windows Store 1.8.15.0) (Windows 10), Board: "Arduino/Genuino Uno" C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetServer.cpp: In member function 'begin': C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetServer.cpp:38:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions. lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status compilation terminated. c:/program files/windowsapps/arduinollc.arduinoide_1.8.15.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Uno. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
What's wrong? I can't understand what it mean.
This is my new, revised code:
The change you made to the code looks pretty good. The only problem I see is that you forgot to move this line:
Serial.println("SUCCESS - SD card initialized.");
That won't actually break your code but it makes the output from your program not so useful. As is, if the SD initialization code was successful, but the Ethernet initialization code caused the program to hang, then you would never get the output that the SD code worked.
DolphinPig28:
The problem is that there's an error:
Arduino: 1.8.7 (Windows Store 1.8.15.0) (Windows 10), Board: "Arduino/Genuino Uno"
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetServer.cpp: In member function 'begin':
lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is caused by a bug in the compiler. It is not caused by anything you did wrong.
This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:
Here's the workaround:
Tools > Board > Boards Manager
Wait for downloads to finish.
When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
Click "Install".
Wait for installation to finish.
Click "Close".
If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.
pert:
The change you made to the code looks pretty good. The only problem I see is that you forgot to move this line:
Serial.println("SUCCESS - SD card initialized.");
That won't actually break your code but it makes the output from your program not so useful. As is, if the SD initialization code was successful, but the Ethernet initialization code caused the program to hang, then you would never get the output that the SD code worked.
This is caused by a bug in the compiler. It is not caused by anything you did wrong.
When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
Click "Install".
Wait for installation to finish.
Click "Close".
If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.
I installed the 1.6.21 version and there's no errors when I upload it.
The problem is that in the serial monitor there's NOTHING, no "Initializing SD card...", no "ERROR - SD card initialization failed!", no "SUCCESS - SD card initialized.", no anything.
And when I opened 192.168.1.20, the website won't load.
HELP!!!!!
Fixed the Serial problem (I forgot to add Serial.begin() ).
But in the Serial Monitor, a ERROR - SD card initialization failed! pop up, even through I swapped the initialization.
Here's my new code:
I change the format and Initializing SD card... SUCCESS - SD card initialized. ERROR - Can't find Kyle Dillon.html file!
(I realized that the file name is wrong in the code)
Here's my new code:
8.3 filename. max 8 characters for name and max 3 for extension. use short file names. the filenames with ~ are the real names of the files. The long names are stored elsewhere and the SD library can't read them.