𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Beginning C for Arduino: [learn C programming for the Arduino and compatible microcontrollers]

✍ Scribed by Purdum, Jack


Publisher
Apress
Year
2012;2013
Tongue
English
Leaves
276
Series
Technology in action
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Beginning C for Arduinois written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. This book introduces you to the C programming language, reinforcing each programming structure with a simple demonstration of how you can use C to control the Arduino family of microcontrollers. Author Jack Purdum uses an engaging style to teach good programming techniques using examples that have been honed during his 25 years of university teaching.Beginning C for Arduinowill teach you:



The C programming language How to use C to control a microcontroller and related hardware How to extend C by creating your own library routines During the course of the book, you will learn the basics of programming, such as working with data types, making decisions, and writing control loops. You'll then progress onto some of the trickier aspects of C programming, such as using pointers effectively, working with the C preprocessor, and tackling file I/O. Each chapter ends with a series of exercises and review questions to test your knowledge and reinforce what you have learned.

✦ Table of Contents


Title Page......Page 2
Copyright Page......Page 3
Dedication Page......Page 4
Contents at a Glance......Page 5
Table of Contents......Page 6
About the Author......Page 14
About the Technical Reviewer......Page 15
Acknowledgments......Page 16
Introduction......Page 17
Resources......Page 18
CHAPTER 1 Introduction......Page 19
Assumptions About You......Page 20
Memory......Page 21
Size......Page 22
Breadboard......Page 23
Verifying the Software......Page 24
Attaching the USB Cable......Page 26
Selecting Your ΞΌc Board in the Integrated Development Environment......Page 27
Port Selection......Page 28
Loading and Running Your First Program......Page 31
The Blink Program......Page 32
Running the Blink Program Code......Page 34
Compiling the Blink Program Code......Page 35
Uploading the Blink Program......Page 36
Summary......Page 38
Expressions......Page 39
Operator Precedence......Page 41
Statement Blocks......Page 42
Function Blocks......Page 43
3. Process Step......Page 44
The Purpose of the Five Program Steps......Page 45
A Revisit to the Blink Program......Page 46
Multiline Comments......Page 47
Data Definition......Page 48
The setup() Function......Page 50
The loop() Function......Page 52
Summary......Page 53
Exercises......Page 54
CHAPTER 3 Arduino C Data Types......Page 55
Variable Names in C......Page 56
Binary Data......Page 57
The char Data Type and Character Sets......Page 58
Generating a Table of ASCII Characters......Page 59
The byte Data Type......Page 60
The float and double Data Types......Page 61
The string Data Type......Page 62
String Data Type......Page 63
The void Data Type......Page 64
Symbol Tables......Page 65
lvalues and rvalues......Page 66
The Bucket Analogy......Page 68
Using the cast Operator......Page 70
Summary......Page 71
Exercises......Page 72
Relational Operators......Page 73
The if Statement......Page 74
A Modified Blink Program......Page 76
The Circuit......Page 77
The Program Code......Page 78
Software Modifications to the Alternate Blink Program......Page 79
The if-else Statement......Page 80
Cascading if Statements......Page 81
Two Types of Increment Operator (++)......Page 83
Precedence of Operators......Page 84
The switch Statement......Page 85
The C Preprocessor......Page 86
Output Step......Page 89
Termination Step......Page 90
Something to Think About......Page 92
Summary......Page 93
Exercises......Page 94
Condition 1: Variable Initialization......Page 95
Using a for Loop......Page 96
The while Loop......Page 98
The do-while Loop......Page 99
The break Statement......Page 100
The continue Statement......Page 101
A Complete Code Example......Page 102
Step 5. Termination......Page 103
Listing 5-1 is Sorta Dumb Code......Page 105
Loops and Coding Style......Page 106
Summary......Page 107
Exercises......Page 108
CHAPTER 6 Functions in C......Page 109
Function Name......Page 110
Function Arguments......Page 111
Function Body......Page 112
Function Signature......Page 113
The Function Should Be Cohesive......Page 114
Writing Your Own Functions......Page 115
Function Type Specifier......Page 116
Function Body......Page 117
Logical AND Operator (&&)......Page 118
Logical NOT (!)......Page 119
Writing Your Function......Page 120
Arguments versus Parameters......Page 121
Leap Year Calculation Program......Page 122
Passing Data Into and Back From a Function......Page 125
Pass by Value......Page 126
Summary......Page 128
Exercises......Page 129
Statement Block Scope......Page 130
Why Use Statement Block Scope?......Page 132
Local Scope......Page 133
Name Collisions and Scope......Page 134
Global Scope......Page 136
The register Storage Class......Page 138
The extern Storage Class......Page 139
Creating a Second Source Code File......Page 140
The volatile keyword......Page 144
Summary......Page 145
Exercises......Page 146
Pointer Name......Page 147
Pointer Scalars......Page 148
Arduino Memory Types......Page 149
C Header Files......Page 151
Using a Pointer......Page 152
Using Indirection......Page 153
Why Are Pointers Useful?......Page 157
Pointers and Arrays......Page 161
The Importance of Scalars......Page 164
Summary......Page 165
Exercises......Page 166
Relational Operations and Test for Equality Using Pointers......Page 167
Pointer Arithmetic......Page 168
Constant lvalues......Page 172
Two-Dimensional Arrays......Page 173
A Small Improvement......Page 175
Two-Dimensional Arrays and Pointers......Page 176
Pointers to Functions......Page 178
enum Data Type......Page 180
The Right-Left Rule......Page 184
Summary......Page 185
Exercises......Page 186
Structures......Page 187
Declaring a Structure......Page 188
Defining a Structure......Page 189
The Dot Operator......Page 190
Returning a Structure from a Function Call......Page 192
Using Structure Pointers......Page 194
Arrays of Structures......Page 197
Unions......Page 198
EEPROM Memory......Page 199
Data Logging......Page 200
Shields......Page 207
Other Uses for Secure Digital Storage......Page 209
Summary......Page 211
Exercises......Page 212
Preprocessor Directives......Page 213
#undef......Page 215
#if, Conditional Directives......Page 216
#else, #endif......Page 217
Parameterized Macros......Page 218
Bitwise AND......Page 219
Bitwise Exclusive OR (XOR)......Page 220
Bitwise Shift Left (<<)......Page 221
One More Example......Page 222
Parameterized Macros...continued......Page 223
Summary......Page 224
Exercises......Page 225
Arduino Libraries......Page 226
The Arduino Core Libraries......Page 228
Using the Forums......Page 229
Using a Core Library......Page 230
Contributed Libraries......Page 231
Other Libraries......Page 233
Writing Your Own Library......Page 235
The Library Header File......Page 236
The Library Code File (Dates.cpp)......Page 237
Setting the Arduino IDE to Use Your Library......Page 239
A Sample Program Using the Dates Library......Page 240
Keyword Coloring (theme.txt)......Page 242
Summary......Page 244
Exercises......Page 245
Seeedino Studio......Page 246
Diligent Inc......Page 247
Tinyos Electronics......Page 248
Cooking Hacks......Page 249
Sources......Page 250
Software......Page 251
Electronic Components......Page 252
Online Component Purchases......Page 253
Experiment!......Page 254
Chapter 2......Page 255
Chapter 3......Page 256
Chapter 4......Page 258
Chapter 5......Page 260
Chapter 6......Page 262
Chapter 7......Page 263
Chapter 8......Page 264
Chapter 9......Page 265
Chapter 10......Page 266
Chapter 11......Page 268
Chapter 12......Page 269
Index......Page 271

✦ Subjects


Nonfiction;Computer Science;Programming


πŸ“œ SIMILAR VOLUMES


Beginning C for Arduino: learn C program
✍ Purdum, Jack Jay πŸ“‚ Library πŸ“… 2012 πŸ› Apress 🌐 English

<em>Beginning C for Arduino</em>Β is written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. This book introduces you to the C programming language, reinforcing each programming structure with a simple demonstration ofΒ how you c

Beginning C for Arduino: Learn C program
✍ Jack Purdum πŸ“‚ Library πŸ“… 2012 πŸ› Apress 🌐 English

<em>Beginning C for Arduino</em> is written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. This book introduces you to the C programming language, reinforcing each programming structure with a simple demonstration of how you c

Beginning C for Arduino: Learn C program
✍ Jack Purdum πŸ“‚ Library πŸ“… 2012 πŸ› Apress 🌐 English

<em>Beginning C for Arduino</em> is written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. This book introduces you to the C programming language, reinforcing each programming structure with a simple demonstration of how you c

Beginning C for Arduino: Learn C Program
✍ Jack Purdum πŸ“‚ Library πŸ“… 2 πŸ› Apress 🌐 English

Beginning C for Arduino is written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. This book introduces you to the C programming language, reinforcing each programming structure with a simple demonstration of how you can use C

Beginning C for Arduino, Second Edition
✍ Purdum, Jack πŸ“‚ Library πŸ“… 2015 πŸ› Apress 🌐 English

Beginning C for Arduino, Second Edition is written for those who have no prior experience with microcontrollers or programming but would like to experiment and learn both. Updated with new projects and new boards, this book introduces you to the C programming language, reinforcing each programming s