Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii1. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 cài đặt môi trường phát triển tích hợp (IDE) 41.2 thiết lập Ban Arduino 61.3 bằng cách sử dụng môi trường phát triển tích hợp (IDE) để chuẩn bịmột Arduino Sketch 81.4 tải lên và chạy các ký họa chớp 111.5 tạo và lưu một bức phác hoạ 131,6 bằng cách sử dụng Arduino 152. thực hiện các ký họa làm đấu thầu....................................... 192.1 cơ cấu chương trình Arduino 202.2 cách sử dụng đơn giản các loại nguyên thủy (biến) 212.3 sử dụng Floating-Point số 232.4 làm việc với các nhóm của các giá trị 252.5 cách sử dụng Arduino String chức năng 282.6 sử dụng ký tự C Strings 302,7 văn bản phẩy chia tách thành các nhóm 322,8 chuyển đổi một số cho một chuỗi 342,9 chuyển đổi một chuỗi một số 362.10 cấu trúc mã của bạn vào các khối chức năng 382.11 trở lại nhiều hơn một giá trị từ một chức năng 412.12 hành động dựa trên điều kiện 442.13 lặp đi lặp lại một chuỗi các câu 452.14 lặp đi lặp lại lời tuyên bố với một truy cập 472.15 phá vỡ ra khỏi vòng 492.16 tham gia một loạt các hành động dựa trên một 50 đơn biến2.17 so sánh nhân vật và số đánh giá 522.18 Comparing Strings 542.19 Performing Logical Comparisons 55vwww.it-ebooks.info2.20 Performing Bitwise Operations 562.21 Combining Operations and Assignment 583. Using Mathematical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613.1 Adding, Subtracting, Multiplying, and Dividing 613.2 Incrementing and Decrementing Values 623.3 Finding the Remainder After Dividing Two Values 633.4 Determining the Absolute Value 643.5 Constraining a Number to a Range of Values 653.6 Finding the Minimum or Maximum of Some Values 663.7 Raising a Number to a Power 673.8 Taking the Square Root 683.9 Rounding Floating-Point Numbers Up and Down 683.10 Using Trigonometric Functions 693.11 Generating Random Numbers 703.12 Setting and Reading Bits 723.13 Shifting Bits 753.14 Extracting High and Low Bytes in an int or long 773.15 Forming an int or long from High and Low Bytes 784. Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814.1 Sending Debug Information from Arduino to Your Computer 864.2 Sending Formatted Text and Numeric Data from Arduino 894.3 Receiving Serial Data in Arduino 924.4 Sending Multiple Text Fields from Arduino in a Single Message 954.5 Receiving Multiple Text Fields in a Single Message in Arduino 984.6 Sending Binary Data from Arduino 1014.7 Receiving Binary Data from Arduino on a Computer 1054.8 Sending Binary Values from Processing to Arduino 107
4.9 Sending the Value of Multiple Arduino Pins 109
4.10 How to Move the Mouse Cursor on a PC or Mac 112
4.11 Controlling Google Earth Using Arduino 115
4.12 Logging Arduino Data to a File on Your Computer 121
4.13 Sending Data to Two Serial Devices at the Same Time 124
4.14 Receiving Serial Data from Two Devices at the Same Time 128
4.15 Setting Up Processing on Your Computer to Send
and Receive Serial Data 131
5. Simple Digital and Analog Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.1 Using a Switch 136
5.2 Using a Switch Without External Resistors 139
5.3 Reliably Detecting the Closing of a Switch 141
5.4 Determining How Long a Switch Is Pressed 144
vi | Table of Contents
www.it-ebooks.info
5.5 Reading a Keypad 149
5.6 Reading Analog Values 152
5.7 Changing the Range of Values 154
5.8 Reading More Than Six Analog Inputs 155
5.9 Displaying Voltages Up to 5V 158
5.10 Responding to Changes in Voltage 161
5.11 Measuring Voltages More Than 5V (Voltage Dividers) 162
6. Getting Input from Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.1 Detecting Movement 167
6.2 Detecting Light 170
6.3 Detecting Motion (Integrating Passive Infrared Detectors) 171
6.4 Measuring Distance 173
6.5 Measuring Distance Accurately 176
6.6 Detecting Vibration 180
6.7 Detecting Sound 181
6.8 Measuring Temperature 185
6.9 Reading RFID Tags 187
6.10 Tracking the Movement of a Dial 190
6.11 Tracking the Movement of More Than One Rotary Encoder 193
6.12 Tracking the Movement of a Dial in a Busy Sketch 195
6.13 Using a Mouse 197
6.14 Getting Location from a GPS 201
6.15 Detecting Rotation Using a Gyroscope 206
6.16 Detecting Direction 208
6.17 Getting Input from a Game Control Pad (PlayStation) 211
6.18 Reading Acceleration 213
7. Visual Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
đang được dịch, vui lòng đợi..
