UDP CR and LF

Hi All,

This is my first post here, so hello everyone.

I've gotten pretty far with a project I'm working on at the moment but have hit a stumbling block.

I have searched everywhere for an answer and this is my final stop. hopefully someone here can help.

I'm working on a back end to the Demopad iDevice home automation app so that it can track when TV's are on or off and the like.

The stumbling block I have hit concerns the sending of CR and LF over UDP. The TV's have global Cache wf2sl's connected to them allowing serial control over wifi. I need to control an LG tv through this and at the end of each command I need to send a Carriage Return and Line Feed but for the life of me I cannot work out how.

If anyone can suggest a way of doing this I would be very grateful!

CJR

Adapting the example code from the Ethernet library reference, I'd imagine this would do it:

void loop() {

  Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    Udp.write("hello\r\n");
    Udp.endPacket();

}

Note the "\r\n" after hello, they are carriage return and line feed. Not compiled.

Hi Wildbill,

Thanks for that. Why I couldn’t find any reference to that is beyond me. I will try it out in a bit and let you know how I get on.

CJR

Those special characters (and others) aren't anything to do with the Arduino specifically- a C or C++ reference would be the place to look for them.