iOS Sensor Apps with Arduino.pdf

(42390 KB) Pobierz
1118530650.009.png
1118530650.010.png
iOS Sensor Apps with Arduino
Alasdair Allan
Beijing
Cambridge
Farnham
Köln
Sebastopol
Tokyo
1118530650.011.png 1118530650.012.png 1118530650.001.png 1118530650.002.png 1118530650.003.png 1118530650.004.png 1118530650.005.png 1118530650.006.png
 
iOS Sensor Apps with Arduino
by Alasdair Allan
Copyright © 2011 Alasdair Allan. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles ( http://my.safaribooksonline.com ) . For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com .
Editors: Shawn Wallace and Brian Jepson
Production Editor: Teresa Elsey
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Revision History for the First Edition:
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. iOS Sensor Apps with Arduino , the image of an agouti, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-30848-3
[LSI]
1317134531
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1.
Introduction to the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Arduino
1
Powering the Board
3
Input and Output
3
Communicating with the Board
3
Installing the Software
3
Connecting to the Board
5
Blinking an LED
6
Uploading the Sketch
9
Making a Serial Connection
11
Summary
13
2.
Connecting the iPhone to the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
The Apple MFi Program
15
The Redpark Serial Cable
16
Testing the Cable
17
Connecting to the Arduino
18
Connecting to an iOS Device
21
A Simple Serial Application
21
Adding the Redpark Serial Library
24
Connecting the Arduino
28
Sending Data Back to the Arduino
30
Log Messages
31
Summary
37
3.
Controlling the Arduino from the iPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
An Arduino on Your iPad
39
Adding the Serial Library
39
Building the User Interface
40
iii
1118530650.007.png 1118530650.008.png
Zgłoś jeśli naruszono regulamin