Bringing It All Together - Arduino Uno Quick Start Manual

Hide thumbs Also See for Arduino Uno:
Table of Contents

Advertisement

Bringing It All Together

With our
PassiveInfraredSensor
a burglar alarm with email notifications. Connect the PIR sensor to the Eth-
ernet shield, as shown in the following figure.
Then enter the following code in your Arduino IDE:
Ethernet/BurglarAlarm/burglar_alarm.h
#ifndef __BURGLAR_ALARM_H__
Line 1
#define __BURGLAR_ALARM_H__
-
#include "pir_sensor.h"
-
#include "smtp_service.h"
-
5
class
BurglarAlarm {
-
PassiveInfraredSensor _pir_sensor;
-
SmtpService
-
void
send_alarm() {
-
Email email(
10
"arduino@example.com",
-
"info@example.net",
-
"Intruder
Alert!",
-
"Someone's moving in your living room!"
-
);
15
_smtp_service.send_email(email);
-
}
-
-
public:
-
BurglarAlarm(
20
const
PassiveInfraredSensor& pir_sensor,
-
const
SmtpService&
-
_pir_sensor(pir_sensor),
-
_smtp_service(smtp_service)
-
{
25
}
-
-
-
and
classes, it s a piece of cake to build
SmtpService
_smtp_service;
smtp_service) :
www.it-ebooks.info
Bringing It All Together
197
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