Hi all,
I have a server churning out some values.
I wish to read the values, in processing.
I have been trying client.read - with no luck?
Can anyone suggest/guide me?
I can read my server data in teraterm with no problems.
Many thanks,
My server code is:
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "---";
char pass[] = "---";
int status = WL_IDLE_STATUS;
int Analog0 = A0;
int Analog1 = A1;
int Analog2 = A2;
int Analog3 = A3;
int Analog4 = A4;
int Analog5 = A5;
int sensorValue0 = 0;
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
int sensorValue4 = 0;
int sensorValue5 = 0;
WiFiServer server(80);
void setup() {
// initialize serial:
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
server.begin();
}
}
void loop() {
// listen for incoming clients
WiFiClient client = server.available();
// to any clients connected to the server:
sensorValue0 = analogRead(A0);
sensorValue1 = analogRead(A1);
sensorValue2 = analogRead(A2);
sensorValue3 = analogRead(A3);
sensorValue4 = analogRead(A4);
sensorValue5 = analogRead(A5);
server.print(sensorValue0,DEC);
server.print(",");
server.print(sensorValue1,DEC);
// server.print(",");
// server.print(sensorValue2,DEC);
// server.print(",");
// server.print(sensorValue3,DEC);
// server.print(",");
// server.print(sensorValue4,DEC);
// server.print(",");
// server.print(sensorValue5,DEC);
server.println(",");
Serial.print(sensorValue0);
Serial.print(",");
Serial.print(sensorValue1);
// Serial.print(",");
// Serial.print(sensorValue2);
// Serial.print(",");
// Serial.print(sensorValue3);
// Serial.print(",");
// Serial.print(sensorValue4);
// Serial.print(",");
// Serial.print(sensorValue5);
Serial.println(",");
delay(0);
}
I have a server churning out some values.
I wish to read the values, in processing.
I have been trying client.read - with no luck?
Can anyone suggest/guide me?
I can read my server data in teraterm with no problems.
Many thanks,
My server code is:
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "---";
char pass[] = "---";
int status = WL_IDLE_STATUS;
int Analog0 = A0;
int Analog1 = A1;
int Analog2 = A2;
int Analog3 = A3;
int Analog4 = A4;
int Analog5 = A5;
int sensorValue0 = 0;
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
int sensorValue4 = 0;
int sensorValue5 = 0;
WiFiServer server(80);
void setup() {
// initialize serial:
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
server.begin();
}
}
void loop() {
// listen for incoming clients
WiFiClient client = server.available();
// to any clients connected to the server:
sensorValue0 = analogRead(A0);
sensorValue1 = analogRead(A1);
sensorValue2 = analogRead(A2);
sensorValue3 = analogRead(A3);
sensorValue4 = analogRead(A4);
sensorValue5 = analogRead(A5);
server.print(sensorValue0,DEC);
server.print(",");
server.print(sensorValue1,DEC);
// server.print(",");
// server.print(sensorValue2,DEC);
// server.print(",");
// server.print(sensorValue3,DEC);
// server.print(",");
// server.print(sensorValue4,DEC);
// server.print(",");
// server.print(sensorValue5,DEC);
server.println(",");
Serial.print(sensorValue0);
Serial.print(",");
Serial.print(sensorValue1);
// Serial.print(",");
// Serial.print(sensorValue2);
// Serial.print(",");
// Serial.print(sensorValue3);
// Serial.print(",");
// Serial.print(sensorValue4);
// Serial.print(",");
// Serial.print(sensorValue5);
Serial.println(",");
delay(0);
}
1