EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #233 background imageLoading...
Page #233 background image
In this case, the protocol name is SAMSUNG, the length of the command code
is 32 bits, and the command code is E0E040BF (the hexadecimal number we
grabbed in Grabbing Remote Control Codes, on page 203).
We already used the Arduino as a web client in Chapter 10, Networking with
Arduino, on page 163, but now we need to turn it into a web server. The server
waits for new HTTP requests like the one shown previously, parses the URL,
and emits the corresponding infrared signal.
Well hide all of these details in a class named
InfraredProxy
, and to keep things
as easy and as concise as possible, well make use of both the Ethernet and
the IRremote library. The
InfraredProxy
class is still one of the books most
sophisticated examples of Arduino code. Heres its interface:
RemoteControl/InfraredProxy/infrared_proxy.h
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
class InfraredProxy {
private:
IRsend _infrared_sender;
void read_line(EthernetClient& client, char* buffer, const int buffer_length);
bool send_ir_data(const char* protocol, const int bits, const long value);
bool handle_command(char* line);
public:
void receive_from_server(EthernetServer server);
};
After including all libraries needed, we declare the
InfraredProxy
class. We define
a member variable named
_infrared_sender
that stores an
IRsend
object we need
to emit infrared control codes. Then we declare three private helper methods
and the
receive_from_server
method, which is the only public method of the
InfraredProxy
class.
Lets have a look at the implementation of all methods. Well start with
read_line
:
report erratum discuss
Building an Infrared Proxy 217
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

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

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals