Go Down

Topic: Read values from webpage to control relay (Ethernet Shield) (Read 5 times) previous topic - next topic

imrobc

I am wondering how to do this myself. I have a website that is hosted with "Hostgator" and I would like to use it to switch on or off a light, nothing to tricky. I even have the Arduino live at http://70.68.49.190:89 so it's port forwarded, and I have the example Sketch working.
How do I write a simple sketch that works with my website rather than Twitter to interface with my Arduino? Is it RSS?
I have a Micro SD card plugged in to the Ethernet shield, is there a way to store HTML, XML and PHP documents on it and just call them when they are needed? 

Thanks for your help and time.
http://whatisacnc.com
The frustration of a CNC

George-Xrik

Hi imrobc

As far as i know you can call data in the SD card at any time however I have never done this. But you will surely find something similar in the forum you can alter to suit your needs. What do mean by interface your website with your arduino ? what do u plan to do?

Divinity82

What if you are using a wifi module instead of ethernet shield?

Do I just change the mac and specify an ip?

SurferTim

#18
Aug 24, 2014, 03:26 pm Last Edit: Aug 24, 2014, 03:30 pm by SurferTim Reason: 1
The wifi and ethernet hardware are just transports, not protocols, so the code is interchangeable. Start the wifi shield in the setup function instead of the ethernet shield, then...
Code: [Select]
// change this
EthernetClient client;
// to this
WiFiClient client;


edit: Take a look at zoomkat's code earlier in this thread for the rest of the code. You can take a look at mine in the playground.
http://playground.arduino.cc/Code/WebClient


Divinity82

#19
Aug 24, 2014, 04:13 pm Last Edit: Aug 24, 2014, 04:23 pm by Divinity82 Reason: 1
Thank you for the reply!  :)

Its returns "WiFiClient does not name a type".

I attempted to change everything to 'WiFi' but it just says not connected.


EDIT
My wifi module can be reached at its ip address on the network... That means it's already connected?
Also, should the module be in server mode or client? I would think client as it is getting data from a server...

SurferTim

#20
Aug 24, 2014, 04:45 pm Last Edit: Aug 24, 2014, 04:53 pm by SurferTim Reason: 1
Then you didn't change the includes to the wifi shield.
Code: [Select]
#include <SPI.h>
#include <WiFi.h>


edit: You keep referring to this device as a module instead of a shield. You should post a link to the wifi hardware you are using.

Divinity82

#21
Aug 24, 2014, 05:48 pm Last Edit: Aug 24, 2014, 05:50 pm by Divinity82 Reason: 1
I posted the English documentation on this module in another persons thread.

http://forum.arduino.cc/index.php?topic=241146.msg1852857#msg1852857

So I presume I need to change all references to "Ethernet" to "WiFi"?

SurferTim

This part is easy. That is not an Arduino WiFi shield. It does not use the same library as the official Wifi shield, so I can't help you with it. Maybe you can get some help from the users in the other thread you posted a link to.



Go Up