Wifi communication

Hello all,

I think my problem is really simple which may be why I can't really find a topic about it...
I have an Arduino Uno and a Wifi shield. I can get it to connect to my Wifi signal. The Arduino is using a power supply so it isn't connected to the computer.

My question is how do I communicate with the Arduino using my wifi signal and a computer connected to the same wifi? Basically all I want to do is read the A0 port remotely.

Thanks in advance!

I'm using the WiFiWebServer example.

Both my computer and the arduino are connected to my WPA2 wireless network.

The serial monitor says...

SSID: ECHO70
IP Address: 172.20.10.5
signal strength (RSSI):-15 dBm

When I go to firefox and type in 172.20.10.5 it says problem loading page, the connection was reset.

Any ideas?

joebot70:
I’m using the WiFiWebServer example.

Don’t! Unless you have a really good usage case for doing so. HTTP is a complicated way to do something so simple and an Arduino with a wifi Shield, is not really suitable for processing HTTP.

You can produce what you are asking for, to send a value over the network to a PC, using this rather simple code snippet.

//we are going to listen on port 1025
WiFiServer server(1025);

void setup() {
//set up and connect to wifi
// you can use the web server example setup function here
}

void loop() {
  WiFiClient  client = server.available();
  if (client) {
    while(client.connected()) {
      uint16_t value = analogRead(A0);
      client.print("value:");
      client.print(value);
      client.print("\r\n");
      delay (1000);
    }
    client.stop();
  }
}

You can now connect to the WiFiShield from a PC using a Telnet client.
If your WiFi shield has the IP 172.20.10.5, you would use this command (in an MSDOS or Terminal session) to connect to it
telnet 172.20.10.5 1025
And you should see the value from A0 being printed about once per second.

Note: if you are using a version of Windows after Vista, you will need to install the Telnet Client using Programs and Features in Control panel. Do not install the Telnet server (it’s a security risk).

Once you have the WiFi shield sending your value, the challenge is then to find a programming language for your PC, which can open a TCP socket and do something with the value. Here is an example I found which uses Processing (of which I know very little).

import processing.net.*; 
Client myClient; 
int dataIn; 
 
void setup() { 
  size(200, 200); 
  // Connect to a host with IP 172.20.10.5 which is listening on port 1025.
  myClient = new Client(this, "172.20.10.5", 1025); 
} 
 
void draw() { 
  if (myClient.available() > 0) { 
    dataIn = myClient.read(); 
  } 
  
  //I have no idea what this does!
  background(dataIn); 
}