C Programming for Arduino
eBook - ePub

C Programming for Arduino

Julien Bayle

Buch teilen
  1. 512 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

C Programming for Arduino

Julien Bayle

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

In Detail

Physical computing allows us to build interactive physical systems by using software & hardware in order to sense and respond to the real world. C Programming for Arduino will show you how to harness powerful capabilities like sensing, feedbacks, programming and even wiring and developing your own autonomous systems.

C Programming for Arduino contains everything you need to directly start wiring and coding your own electronic project. You'll learn C and how to code several types of firmware for your Arduino, and then move on to design small typical systems to understand how handling buttons, leds, LCD, network modules and much more.

After running through C/C++ for the Arduino, you'll learn how to control your software by using real buttons and distance sensors and even discover how you can use your Arduino with the Processing framework so that they work in unison. Advanced coverage includes using Wi-Fi networks and batteries to make your Arduino-based hardware more mobile and flexible without wires. If you want to learn how to build your own electronic devices with powerful open-source technology, then this book is for you.

Approach

Written as a practical Packt book brimming with engaging examples, C Programming for Arduino will help those new to the amazing open source electronic platform so that they can start developing some great projects from the very start.

Who this book is for

This book is great for people who want to learn how to design & build their own electronic devices. From interaction design art school students to the do-it-yourself hobbyist, or even simply people who want to learn electronics, this book will help by adding a new way to design autonomous but connected devices.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist C Programming for Arduino als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu C Programming for Arduino von Julien Bayle im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatik & Programmierung in C. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2013
ISBN
9781849517584

C Programming for Arduino


Table of Contents

C Programming for Arduino
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Let's Plug Things
What is a microcontroller?
Presenting the big Arduino family
About hardware prototyping
Understanding Arduino software architecture
Installing Arduino development environment (IDE)
Installing the IDE
How to launch the environment?
What does the IDE look like?
Installing Arduino drivers
Installing drivers for Arduino Uno R3
Installing drivers for Arduino Duemilanove, Nano, or Diecimilla
What is electricity?
Voltage
Current and power
And what are resistors, capacitors, and so on?
Wiring things and Fritzing
What is Fritzing?
Power supply fundamentals
Hello LED!
What do we want to do exactly?
How can I do that using C code?
Start with a new blank page
Setting up the environment according the board we are using
Let's write the code
Let's upload the code, at last!
Summary
2. First Contact with C
An introduction to programming
Different programming paradigms
Programming style
C and C++?
C is used everywhere
Arduino is programmed with C and C++
The Arduino native library and other libraries
Discovering the Arduino native library
Other libraries included and not directly provided
Some very useful included libraries
Some external libraries
Checking all basic development steps
Using the serial monitor
Baud rate
Serial communication with Arduino
Serial monitoring
Making the Arduino talk to us
Adding serial communication to Blink250ms
Serial functions in more detail
Serial.begin()
Serial.print() and Serial.println()
Digging a bit…
Talking to the board from the computer
Summary
3. C Basics – Making You Stronger
Approaching variables and types of data
What is a variable?
What is a type?
The roll over/wrap concept
Declaring and defining variables
Declaring variables
Defining variables
String
String definition is a construction
Using indexes and search inside String
charAt()
indexOf() and lastIndexOf()
startsWith() and endsWith()
Concatenation, extraction, and replacement
Concatenation
Concat()
Using the + operator on strings
Extract and replace
substring() is the extractor
Splitting a string using a separator
Replacement
Other string functions
toCharArray()
toLowerCase() and toUpperCase()
trim()
length()
Testing variables on the board
Some explanations
The scope concept
static, volatile, and const qualifiers
static
volatile
const
Operators, operator structures, and precedence
Arithmetic operators and types
Character types
Numerical types
Condensed notations and precedence
Increment and decrement operators
Types manipulations
Choosing the right type
Implicit and explicit types conversions
Implicit type conversion
Explicit type conversion
Comparing values and Boolean operators
Comparison expressions
Combining comparisons with Boolean operators
Combining negation and comparisons
Adding conditions in the code
if and else conditional structure
Chaining an if…else structure to another if…else structure
if…else structure with combined comparisons expressions
Finding all cases for a conditional structure
switch…case…break conditional structure
Ternary operator
Making smart loops for repetitive tasks
for loop structure
Playing with increment
More complex increments
Decrements are negative increments
Using imbricated for loops or two indexes
while loop structure
do…while loop structure
Breaking the loops
Infinite loops are not your friends
Summary
4. Improve Programming with Functions, Math, and Timing
Introducing functions
Structure of a function
Creating function prototypes using the Arduino IDE
Header and name of functions
Body and statements of functions
Benefits of using functions
Easier coding and debugging
Better modularity helps reusability
Better readability
C standard mathematical functions and Arduino
Trigonometric C functions in the Arduino core
Some prerequisites
Difference between radians and degrees
Cosine, sine, and tangent
Arccosine, arcsine, and arctangent
Trigonometry functions
Exponential functions and some others
Approaching calculation optimization
The power of the bit shift operation
What are bit operations?
Binary numeral system
Easily converting a binary number to a decimal number
AND, OR, XOR, and NOT operators
AND
OR
XOR
NOT
Bit shift operations
It is all about performance
The switch case labels optimization techniques
Optimizing the range of cases
Optimizing cases according to their frequency
Smaller the scope, the better the board
The Tao of returns
Direct returns concept
Use void if you don't need return
Secrets of lookup tables
Table initialization
Replacing pure calculation with array index operations
Taylor series expansion trick
The Arduino core even provides pointers
Time measure
Does the Arduino board own a watch?
The millis() function
The micros() function
Delay concept and the program flow
What does the program do du...

Inhaltsverzeichnis