Arduino Uno Quick Start Manual page 234

Hide thumbs Also See for Arduino Uno:
Table of Contents

Advertisement

RemoteControl/InfraredProxy/infrared_proxy.cpp
void
InfraredProxy::read_line(
EthernetClient& client, char* buffer,
{
int
buffer_pos = 0;
while
(client.available() && (buffer_pos < buffer_length - 1)) {
const char
c = client.read();
if
(c == '\n')
break;
if
(c != '\r')
buffer[buffer_pos++] = c;
}
buffer[buffer_pos] = '\0';
}
read_line
reads one line of data sent by a client. A line ends either with a newline
character (\n) or with a carriage return character followed by a newline
character (\r\n).
read_line
character buffer to store the data in (
character buffer (
buffer_length
return characters, and it sets the line s last character to \0 so the buffer to
be filled will always be a null-terminated string.
send_ir_data
is responsible for sending infrared commands:
RemoteControl/InfraredProxy/infrared_proxy.cpp
bool
InfraredProxy::send_ir_data(
const
char* protocol,
{
bool
result = true;
if
(!strcasecmp(protocol, "NEC"))
_infrared_sender.sendNEC(value, bits);
else if
(!strcasecmp(protocol, "SONY"))
_infrared_sender.sendSony(value, bits);
else if
(!strcasecmp(protocol, "RC5"))
_infrared_sender.sendRC5(value, bits);
else if
(!strcasecmp(protocol, "RC6"))
_infrared_sender.sendRC6(value, bits);
else if
(!strcasecmp(protocol, "DISH"))
_infrared_sender.sendDISH(value, bits);
else if
(!strcasecmp(protocol, "SHARP"))
_infrared_sender.sendSharp(value, bits);
else if
(!strcasecmp(protocol, "JVC"))
_infrared_sender.sendJVC(value, bits, 0);
else if
(!strcasecmp(protocol, "SAMSUNG"))
_infrared_sender.sendSAMSUNG(value, bits);
else
result = false;
return
result;
}
Chapter 12. Creating Your Own Universal Remote Control
const int
expects the
EthernetClient
buffer
), and the maximum length of the
). The method ignores all newline and carriage
const int
bits,
const long
www.it-ebooks.info
buffer_length)
object to read data from, a
value)
218
report erratum
discuss

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Arduino Uno and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents