EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
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 #213 background imageLoading...
Page #213 background image
Bringing It All Together
With our
PassiveInfraredSensor
and
SmtpService
classes, its a piece of cake to build
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 _smtp_service;
-
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& smtp_service) :
-
_pir_sensor(pir_sensor),
-
_smtp_service(smtp_service)
-
{
25
}
-
-
-
report erratum discuss
Bringing It All Together 197
www.it-ebooks.info

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals