Arduino編程從基礎到實踐

Arduino編程從基礎到實踐

《Arduino編程從基礎到實踐》是2015年10月出版的圖書。

基本介紹

  • 中文名:Arduino編程從基礎到實踐
  • 出版時間:2015年10月
基本信息,內容簡介,目錄信息,

基本信息

著 者:(美)Brian Evans (布萊恩?埃文斯)
zhua曲子白渡白顆
作 譯 者:楊繼志,郭敬
千 字 數:375
版 次:01-01
頁 數:288
開 本:16開
I S B N :9787121272530

內容簡介

目前Arduino開源硬體技術在國內漸漸興起,相關的圖書的市場表現不錯,作為計算機的硬體科學,這本書apress系列書之一,內容正統,篇幅適中,翻譯難度不大。與電子社已經獲得著作權的《beginning arduino》(偏重案例)和《arduino robotics》(偏重高端套用)相比,偏重初級與中級理論實踐普及方面,屬於入門圖書,讀者基數多。

目錄信息

第 1 章 開始 .................................................................................................................................1
Arduino 是為 DIY 愛好者設計的 ............................................................................................1
Arduino 生態系統 ...................................................................................................................3
Arduino 平台 ...................................................................................................................3
開源硬體 .........................................................................................................................4
社區 .................................................................................................................................5
Arduino 世界 ...................................................................................................................6
Arduino 採用 C 語言還是其他語言 .......................................................................................7
我們需要什麼元件 .................................................................................................................9
進入正題 .............................................................................................................................. 11
安裝軟體 ...................................................................................................................... 12
連線到 Arduino ............................................................................................................ 13
打開一個框架 .............................................................................................................. 13
選擇板子和串口 .......................................................................................................... 14
上傳框架 ...................................................................................................................... 15
總結 ...................................................................................................................................... 16
第 2 章 代碼架構 ....................................................................................................................... 17
什麼是代碼的框架 .............................................................................................................. 18
項目 1:RGB 閃燈 ............................................................................................................... 19
把它連上 .......................................................................................................................20
上傳代碼 ...................................................................................................................... 21
代碼總結 ...................................................................................................................... 22
Arduino C 的結構 ................................................................................................................. 22
使用注釋 ...................................................................................................................... 23
基本函式 ...................................................................................................................... 24
語句和語法 ...................................................................................................................26
確認和上傳 ........................................................................................................................... 27
確認 ............................................................................................................................... 27
保存 .............................................................................................................................. 28
上傳 .............................................................................................................................. 29
常見的錯誤 .................................................................................................................. 30
總結 ...................................................................................................................................... 32
第 3 章 使用變數 ...................................................................................................................... 34
項目 2:七色變色燈 ........................................................................................................... 35
把它們連線起來 .......................................................................................................... 35
上傳原始碼 .................................................................................................................. 36
代碼總結 ....................................................................................................................... 37
什麼是變數 .......................................................................................................................... 38
聲明變數 ...................................................................................................................... 39
變數名 .......................................................................................................................... 40
數據類型 ...................................................................................................................... 41
變數修飾 ...................................................................................................................... 43
預定義常量 .................................................................................................................. 44
變數作用域 .................................................................................................................. 44
使用操作符 .......................................................................................................................... 45
數學運算符:+、-、*、/ ........................................................................................... 46
複合操作符:++、‐‐、+=、-=、 * =、/= ...................................................................... 47
運算順序 ...................................................................................................................... 48
總結 ...................................................................................................................................... 49
第 4 章 進行判斷 ...................................................................................................................... 50
項目 3:閃燈 ........................................................................................................................51
把它連線起來 ...............................................................................................................51
上傳代碼 ....................................................................................................................... 52
原始碼總結 .................................................................................................................. 54
對比和邏輯操作 .................................................................................................................. 56
控制結構 .............................................................................................................................. 58
if .................................................................................................................................... 58
for.................................................................................................................................. 60
while ............................................................................................................................. 61
do ................................................................................................................................... 62
switch ............................................................................................................................ 63
break ............................................................................................................................. 64
continue ........................................................................................................................ 65
總結 ...................................................................................................................................... 65
第 5 章 數字輸入和輸出 ........................................................................................................... 67
Arduino I/O 擴展 .................................................................................................................. 68
項目 4:吵鬧的蛐蛐 ............................................................................................................ 70
把它連起來 ................................................................................................................... 70
上傳代碼 ....................................................................................................................... 72
原始碼總結 ...................................................................................................................73
數字函式 .............................................................................................................................. 75
pinMode() ..................................................................................................................... 75
digitalWrite() .................................................................................................................. 76
digitalRead() .................................................................................................................. 77
狀態轉換 ............................................................................................................................... 78
切換 .............................................................................................................................. 79
計數 .............................................................................................................................. 81
模式 ...............................................................................................................................82
總結 ...................................................................................................................................... 85
第 6 章 模擬輸入、模擬輸出 .................................................................................................. 86
模擬量揭秘 ........................................................................................................................... 87
項目 5:呼吸遠程信息處理 ............................................................................................... 88
把它們連起來 .............................................................................................................. 89
上傳代碼 ...................................................................................................................... 91
原始碼總結 .................................................................................................................. 91
模擬函式 .............................................................................................................................. 93
analogRead() ................................................................................................................. 93
analogWrite() ................................................................................................................ 95
analogReference() ......................................................................................................... 96
模擬串口監視器 ................................................................................................................... 97
讀模擬值 ...................................................................................................................... 98
使用串口監視器 .......................................................................................................... 99
它是如何工作的 ........................................................................................................ 100
映射數值 ............................................................................................................................ 101
map() ........................................................................................................................... 101
constrain() ....................................................................................................................102
總結 .................................................................................................................................... 103
第 7 章 高級函式 .................................................................................................................... 104
時間函式 ............................................................................................................................ 105
delay() ......................................................................................................................... 105
delayMicroseconds() ................................................................................................... 106
millis() .......................................................................................................................... 107
micros() ....................................................................................................................... 109
隨機函式 ............................................................................................................................ 109
random() ..................................................................................................................... 110
randomSeed() ............................................................................................................. 112
項目 6:環境溫度 ............................................................................................................. 113
連線起來 .................................................................................................................... 114
上傳原始碼 ................................................................................................................ 116
原始碼總結 ................................................................................................................ 118
寫函式 ................................................................................................................................ 121
聲明函式 .................................................................................................................... 121
調用函式 .................................................................................................................... 122
函式返回值 ................................................................................................................ 122
函式的參數 ................................................................................................................ 124
項目 7:HSB 彩色 LED ....................................................................................................... 125
把它們連起來 ............................................................................................................ 125
上傳原始碼 ................................................................................................................. 127
原始碼總結 ................................................................................................................ 129
硬體中斷 ............................................................................................................................ 130
attachInterrupt() ......................................................................................................... 131
detachInterrupt() ........................................................................................................ 132
總結 .................................................................................................................................... 132
第 8 章 數組和存儲區 ............................................................................................................ 133
項目 8:占卜機 ................................................................................................................. 134
把它們連起來 ............................................................................................................ 134
上傳原始碼 ................................................................................................................ 136
原始碼總結 ................................................................................................................ 139
數組 .................................................................................................................................... 143
聲明數組 .................................................................................................................... 143
使用數組 .................................................................................................................... 145
字元數組 .................................................................................................................... 148
多維數組 .................................................................................................................... 149
Arduino 存儲器 .................................................................................................................. 151
檢查剩餘的 RAM ....................................................................................................... 153
使用程式存儲空間 .................................................................................................... 154
使用 EEPROM ............................................................................................................. 156
總結 .................................................................................................................................... 158
第 9 章 硬體庫 ........................................................................................................................ 159
使用庫 ................................................................................................................................ 160
生成一個實例 ............................................................................................................ 160
初始化庫 .................................................................................................................... 161
LiquidCrystal 庫 .................................................................................................................. 161
例子代碼:用 Arduino 顯示詩句 ............................................................................. 163
LiquidCrystal() ............................................................................................................. 164
begin() ......................................................................................................................... 165
print() .......................................................................................................................... 165
clear() .......................................................................................................................... 166
setCursor() .................................................................................................................. 166
例子代碼:符號和 Characters() ................................................................................ 166
write() ......................................................................................................................... 168
createChar() ................................................................................................................ 169
例子代碼:魚缸動畫 ................................................................................................ 171
scrollDisplayLeft()和 scrollDisplayRight() ..................................................................... 173
舵機庫 ................................................................................................................................. 174
例子代碼:鬧鐘 ......................................................................................................... 176
舵機 ............................................................................................................................ 177
attach() ........................................................................................................................ 177
write() .......................................................................................................................... 178
步進電機 .............................................................................................................................179
例子代碼:60s 掃描 .................................................................................................. 183
Stepper ....................................................................................................................... 183
setSpeed() ................................................................................................................... 184
step() ........................................................................................................................... 184
SD 卡庫 ............................................................................................................................... 186
例子代碼:SD 卡記錄儀 ........................................................................................... 188
File .............................................................................................................................. 189
SD.begin() .................................................................................................................... 190
SD.open() .................................................................................................................... 190
close() ......................................................................................................................... 191
write() ......................................................................................................................... 191
print() .......................................................................................................................... 191
例子代碼:SD 卡閃爍 ................................................................................................ 192
available() ................................................................................................................... 193
read() .......................................................................................................................... 193
總結 .................................................................................................................................... 194
第 10 章 串列通信和 I2C ....................................................................................................... 195
使用硬體串口 .................................................................................................................... 196
項目 9:串口控制舵機 ..................................................................................................... 198
把它連起來 ................................................................................................................ 198
上傳代碼 .................................................................................................................... 199
代碼總結 .................................................................................................................... 200
串口庫 ................................................................................................................................ 200
begin() ......................................................................................................................... 201
available() ................................................................................................................... 201
read() ........................................................................................................................... 202
print() .......................................................................................................................... 204
println() ....................................................................................................................... 205
write() ......................................................................................................................... 205
項目 10:RFID 讀卡器 ....................................................................................................... 206
把東西連線起來 ........................................................................................................ 206
上傳原始碼 ................................................................................................................. 207
原始碼總結 ................................................................................................................ 209
軟串口庫 ............................................................................................................................ 210
SoftwareSerial() .......................................................................................................... 211
begin() ......................................................................................................................... 211
flush() .......................................................................................................................... 211
strncmp() .................................................................................................................... 212
項目 11:串列時鐘 ........................................................................................................... 213
把它們連線起來 ........................................................................................................ 213
上傳原始碼 ................................................................................................................ 214
代碼總結 .....................................................................................................................217
wire 庫 ................................................................................................................................ 222
begin() ......................................................................................................................... 222
beginTransmission() .................................................................................................... 223
endTransmission() ....................................................................................................... 223
write() ......................................................................................................................... 223
requestFrom(); ......................................................................................................... 224
read() .......................................................................................................................... 224
總結 .................................................................................................................................... 224
第 11 章 繼續 .......................................................................................................................... 226
建立更多的項目 ................................................................................................................ 226
紅利項目 1:做個自動傳送 Twitter 的項目 ............................................................ 226
紅利項目 2:使東西運動 ......................................................................................... 229
紅利項目 3:大型的東西 ......................................................................................... 235
學習其他語言 .................................................................................................................... 236
Firmata ........................................................................................................................ 236
Processing ................................................................................................................... 238
PureData ..................................................................................................................... 239
為社區做貢獻 .................................................................................................................... 241
參與線上論壇 ............................................................................................................ 241
發布你的項目 ............................................................................................................ 243
總結 .................................................................................................................................... 245
第 12 章 基礎電子學 ............................................................................................................... 247
基礎電子學 ........................................................................................................................ 248
電路 ............................................................................................................................ 248
電源 ............................................................................................................................ 249
常見元件 ............................................................................................................................ 250
電阻 .............................................................................................................................251
電容 .............................................................................................................................251
二極體 ......................................................................................................................... 252
三極體 .........................................................................................................................253
開關 .............................................................................................................................255
電機 ............................................................................................................................ 256
讀原理圖 ............................................................................................................................. 257
原型 .................................................................................................................................... 258
麵包板 ........................................................................................................................ 259
焊接 ..................................................................................................................................... 262
總結 .................................................................................................................................... 264
附錄 資源 ................................................................................................................................ 265
附加資源 ............................................................................................................................ 265
論壇 ............................................................................................................................ 265
指導書 ........................................................................................................................ 266
其他素材 .................................................................................................................... 266
選擇供應商 ......................................................................................................................... 267
本書中用到的元件 ............................................................................................................ 268

相關詞條

熱門詞條

聯絡我們