@bko Thank you alot, that worked and to me it seems much simpler than to be connected serial and instaling programs and so on, but that’s my opinion
I am glad it worked out for you! It occurred to me after I posted that one of my tutorial web pages would well for you:
If you use edit the HTML file in this example to add your access token (which you need to keep secret) and the load this page in a web browser using the file:/// syntax, you can enter your publish string (“myIPAddr”) and see you address easily:
hi @bko i followed the steps but the website doesn’t shows
webClient.println(“I’m serving a webpage!\n\n”);
this line of code. mind helping me out? thanks
Hi @JAlonso
Sorry I was away for a few days.
-
Are you sure you have the right local address? How are you getting that? Via publish or checking router logs or static IP?
-
What happens when you do go to the address? Anything at all?
-
What happens if you use curl like this:
curl -v http://10.0.1.5
substituting your core’s IP address for 10.0.1.5 or course.
Hi @bko thx for reply, its ok for late or what haha
yes i see an publish ip address via “view-source:https://api.spark.io/v1/devices/device_id/events/myIPAddr/?access_token=<>” when i go to the address, which i published, it give me nothing.
where shoud i put “curl -v http://10.0.1.5” ? in cmd? in code? after substituting core IP to 10.0.1.5, then 10.0.1.5 will be the address to access core?
Hi @JAlonso
Whatever IP address you get back from the
view-source:https://api.spark.io/v1/devices/device_id/events/myIPAddr/?access_token=<>
URL in your browser (let’s pretend you got back 192.168.0.3 for example), then in a cmd shell (assuming you have installed curl) do this:
curl -v http://192.168.0.3
so, after i installed curl(currently don’t know what is this), i go to cmd and run “curl -v http://ip_i_get” then i can access the core with “ip_i_get”?
Hi @JAlonso
curl does web requests (GET PUT POST) like a browser but from the command line. The -v flag is verbose and will tell us if the connection is responding at all. It is just a debugging tool.
thx appreciated that… will try out with core tomorrow. thx again.
Ok. It’s 2017 now, and here are some changes and hints to get this example to work.
- Compiler tells me Spark is deprecated in favor of Particle. Ok. Small change. and it’s only a deprecation, not an error.
- Problem. "/workspace/tinywebserver.cpp:11: undefined reference to
spark::NetworkClass::localIP()
" On expanding error the helpful line is replaceNetwork.localIP();
withWiFi.localIP();
- Go to https://console.particle.io/devices , find your device, Under
Variables
->ipAddress
, click [Get
] and read the IP address. It might be something like192.168.0.104
. - Open a browser and type in that ip with aport of
80
. For example192.168.0.104:80
. You should get a web page that saysI'm serving a webpage!
.