Hardware Reference
In-Depth Information
Write a log of who is granted access so that you know who enters your room. You could
reuse the code from Chapter 17, “he Techno-Bird Box, a Wildlife Monitor”. A varia-
tion on this would be to send an e-mail or tweet when access was granted or attempted.
You could trigger the Raspberry Pi camera too to record a photograph of a person try-
ing to gain access. Using the other outputs on PiFace Digital, you could trigger an elec-
tric water pistol to deter unauthenticated access.
he authentication block could be extended so that access was granted only at certain
times of day.
If you're familiar with web programming, you could set up a web server on the
Raspberry Pi and unlock your door by sending a password via a web page on your
smartphone.
You could experiment with diferent input devices, such as a biometric scanner if you
can aford one. Barcode and magstripe readers are more afordable alternatives.
If you are feeling really ambitious, you could ind code online to do image recognition
and use the Raspberry Pi camera. OpenCV is a useful library.
Another ambitious extension would be to use Asterisk or Twilio to unlock the door
when you dial a telephone number or send a text.
You could be really creative and come up with your own authentication method.
The Art of Programming
his chapter should have shown you an important feature about computer programs - that
they change. Requirements change during the life of a program, which means parts need to
be swapped out or rewritten. Part of the art of programming is structuring code so that it is
easy to maintain later, particularly when you start working with other programmers.
Managing software development is diicult; for more information about how large, compli-
cated programs are written in industry, search online for “extreme programming” or “agile
methodologies” such as “scrum”.
Programmers may talk about refactoring. Refactoring is basically the matter of tidying up
code to improve its structure without changing its behaviour. It requires discipline, but makes
maintaining code easier in the long term.
You should have seen that a good approach is to build a simple system with limited features
that works, and then add more features later. he goal is to write code in such a way that
you're always fairly close to having a program that runs, even if parts of it are massively
 
Search WWH ::




Custom Search