I just tested it with a fresh new install of the IoT image. When the board booted without the SD card the sketch worked. Then when the board booted with the SD card it automatically connected to Ethernet, but when I uploaded the sketch the program is not writing the correct IP address nor reading it. I compared the Ethernet configuration before and after I uploaded the sketch and nothing changed. This could be due to the fact that the SPI image is based on uclibc and the IoT image in eglibc, also when you select Galileo in the IDE it uses the uclibc. Let me do further tests into this. In the meantime have you tried setting up the IP address and Ethernet connection with Linux commands through the Arduino IDE by using the system() function?
Thank you for looking into this issue. I have added the following lines into my sketch in the setup section to set up the IP and Ethernet:
system("ifconfig enp0s20f6 up");
system("ifconfig enp0s20f6 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255");
The sketch is still not writing or reading the correct IP address. I still get "Server at "Server at 255.255.255.255". What do you recommend I do next?
MachineLearner, You can check the ip address and current configuration with the command ifconfig enp0s20f6 with this you can know if it configured correclty. You can display it in the serial monitor with the following command;
system("ifconfig enp0s20f6 > /dev/ttyGS0");
Try this and let me know if it helps.
ifconfig enp0s20f6 shows the following, which looks to me like it is configured correctly. Does it look the same to you?
enp0s20f6 Link encap:Ethernet HWaddr 98:4F:EE:01:D4:D6
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::9a4f:eeff:fe01:d4d6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13468 errors:0 dropped:2 overruns:0 frame:0
TX packets:8137 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:3340365 (3.1 MiB) TX bytes:1125528 (1.0 MiB)
What do you think?
I tried doing some research into how web servers work, and what the IoT Dev Kit is capable of (my knowledge is very limited in those topics), and here are some steps I did that helped me:
- The WebServer Arduino sketch that I attached uses the default HTTP port (port 80), which I think part of the problem is my ISP is not letting me use that port (I could be wrong). When I replaced it with a different port (e.g., port 81), I was able to connect to the server through that port.
- Part of learning about web servers is I learned that I needed to enable a couple of things on the router side, like enable my router to forward traffic from the internet to my Galileo IP address, and declare my Galileo as a DMZ so it can accept requests from outside of the network, etc., so I did that.
So the summary is, yes, I found a way to start a web server on my Galileo board that displays a static page, and now I need to find a way to use a scripting language (NodeJS maybe?) to be able to write apps that talk to the board and do some more controls.
My next project is to enable a wireless communication between the Galileo board and an orientation/rotation sensor, so when my garage door is open, I get a nudge from a web app letting me know so I can go close the door. This will be a lot of fun to learn!
Thanks for all the help!