Go Down

Topic: Client and Server as - Processing and Arduino. (Read 655 times) previous topic - next topic

Wi11turner

Hi all,

I am trying to achieve a arduino server that sends data to clients after a certain client message request.

My client sends a message GET to the server asking for some data (Processing sends this). As:

[loop function here with delay]
  myClient.write("X");


I have arduino receiving this message, and it can be seen in the serial monitor with:

      char thisChar = client.read();

        Serial.println(thisChar);

The message comes out as:
X
X
X
etc


I am trying to apply a IF statement to the client.read().


For example:

if(thisChar = 'X'){
Serial.println("X received and recognised");
server.write("X recognised");


Essentially I do not have the basic knowledge to convert the client message into something arduino understands - and then can take actions on this.

If anyone could help me out in this - it would be much appreciated.

I imagine it wont be anything too crazy.


Many thanks.

dxw00d

Code: [Select]
if(thisChar = 'X'){

A single equal sign is an assignment. You need the double equal sign for a comparison.

Code: [Select]
if(thisChar == 'X'){

http://arduino.cc/en/Reference/Assignment
http://arduino.cc/en/Reference/If

Wi11turner

:D! Thank you dxw00d,

I thought it might be something minor yet critical.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy