没有合适的资源?快使用搜索试试~ 我知道了~
首页Arduino Cookbook 2nd 原版pdf by Margolis
Arduino Cookbook 2nd 原版pdf by Margolis
需积分: 9 92 浏览量
更新于2023-05-31
评论
收藏 17.49MB PDF 举报
This book was written by Michael Margolis with Nick Weldin to help you explore the amazing things you can do with Arduino. Arduino is a family of microcontrollers (tiny computers) and a software creation environment that makes it easy for you to create programs (called sketches) that can interact with the physical world. Things you make with Arduino can sense and respond to touch, sound, position, heat, and light. This type of technology, often referred to as physical computing, is used in all kinds of things from the iPhone to automobile electronics systems. Arduino makes it possible for anyone with an interest—even people with no programming or electronics experience—to use this rich and complex technology.
资源详情
资源评论
资源推荐


SECOND EDITION
Arduino Cookbook
Michael Margolis
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Sebastopol
•
Tokyo

Arduino Cookbook, Second Edition
by Michael Margolis
Copyright © 2012 Michael Margolis, Nicholas Weldin. 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
Proofreader: Kiel Van Horn
Indexer: Lucie Haskins
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
March 2011: First Edition.
December 2011: Second Edition.
Revision History for the Second Edition:
2011-12-09 First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449313876 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Arduino Cookbook, the image of a toy rabbit, 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-31387-6
[LSI]
1323465788

Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1
Installing the Integrated Development Environment (IDE) 4
1.2 Setting Up the Arduino Board 8
1.3
Using the Integrated Development Environment (IDE) to Prepare
an Arduino Sketch 10
1.4
Uploading and Running the Blink Sketch 13
1.5
Creating and Saving a Sketch 14
1.6
Using Arduino 17
2. Making the Sketch Do Your Bidding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1
Structuring an Arduino Program 24
2.2
Using Simple Primitive Types (Variables) 25
2.3
Using Floating-Point Numbers 27
2.4
Working with Groups of Values 29
2.5
Using Arduino String Functionality 32
2.6
Using C Character Strings 37
2.7
Splitting Comma-Separated Text into Groups 38
2.8
Converting a Number to a String 41
2.9
Converting a String to a Number 43
2.10
Structuring Your Code into Functional Blocks 45
2.11
Returning More Than One Value from a Function 49
2.12
Taking Actions Based on Conditions 52
2.13
Repeating a Sequence of Statements 53
2.14
Repeating Statements with a Counter 55
2.15
Breaking Out of Loops 58
2.16
Taking a Variety of Actions Based on a Single Variable 59
2.17
Comparing Character and Numeric Values 61
2.18
Comparing Strings 63
2.19
Performing Logical Comparisons 64
iii

2.20 Performing Bitwise Operations 65
2.21 Combining Operations and Assignment 68
3. Using Mathematical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.1 Adding, Subtracting, Multiplying, and Dividing 69
3.2 Incrementing and Decrementing Values 70
3.3 Finding the Remainder After Dividing Two Values 71
3.4 Determining the Absolute Value 72
3.5 Constraining a Number to a Range of Values 73
3.6 Finding the Minimum or Maximum of Some Values 74
3.7 Raising a Number to a Power 75
3.8
Taking the Square Root 76
3.9
Rounding Floating-Point Numbers Up and Down 76
3.10
Using Trigonometric Functions 77
3.11
Generating Random Numbers 78
3.12
Setting and Reading Bits 80
3.13 Shifting Bits 84
3.14
Extracting High and Low Bytes in an int or long 85
3.15 Forming an int or long from High and Low Bytes 87
4. Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.1
Sending Debug Information from Arduino to Your Computer 94
4.2
Sending Formatted Text and Numeric Data from Arduino 97
4.3
Receiving Serial Data in Arduino 100
4.4
Sending Multiple Text Fields from Arduino in a Single Message 105
4.5
Receiving Multiple Text Fields in a Single Message in Arduino 111
4.6
Sending Binary Data from Arduino 114
4.7
Receiving Binary Data from Arduino on a Computer 118
4.8
Sending Binary Values from Processing to Arduino 120
4.9
Sending the Value of Multiple Arduino Pins 122
4.10
How to Move the Mouse Cursor on a PC or Mac 125
4.11
Controlling Google Earth Using Arduino 130
4.12
Logging Arduino Data to a File on Your Computer 135
4.13
Sending Data to Two Serial Devices at the Same Time 138
4.14
Receiving Serial Data from Two Devices at the Same Time 141
4.15
Setting Up Processing on Your Computer to Send
and Receive Serial Data 145
5. Simple Digital and Analog Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5.1 Using a Switch 150
5.2 Using a Switch Without External Resistors 154
5.3
Reliably Detecting the Closing of a Switch 155
5.4
Determining How Long a Switch Is Pressed 158
iv | Table of Contents
剩余720页未读,继续阅读
















nn123456789
- 粉丝: 14
- 资源: 128
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- ARM Cortex-A(armV7)编程手册V4.0.pdf
- ABB机器人保养总结解析.ppt
- 【超详细图解】菜鸡如何理解双向链表的python代码实现
- 常用网络命令的使用 ipconfig ping ARP FTP Netstat Route Tftp Tracert Telnet nslookup
- 基于单片机控制的DC-DC变换电路
- RS-232接口电路的ESD保护.pdf
- linux下用time(NULL)函数和localtime()获取当前时间的方法
- Openstack用户使用手册.docx
- KUKA KR 30 hA,KR 60 hA机器人产品手册.pdf
- Java programming with JNI
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论0