Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
C Programming for Arduino

You're reading from  C Programming for Arduino

Product type Book
Published in May 2013
Publisher Packt
ISBN-13 9781849517584
Pages 512 pages
Edition 1st Edition
Languages
Author (1):
Julien Bayle Julien Bayle
Profile icon Julien Bayle

Table of Contents (21) Chapters

C Programming for Arduino
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Let's Plug Things First Contact with C C Basics – Making You Stronger Improve Programming with Functions, Math, and Timing Sensing with Digital Inputs Sensing the World – Feeling with Analog Inputs Talking over Serial Designing Visual Output Feedback Making Things Move and Creating Sounds Some Advanced Techniques Networking Playing with Max 6 Framework Improving your C Programming and Creating Libraries Index

Chapter 7. Talking over Serial

We already saw that using Arduino is all about talking and sharing signals. Indeed, from the most basic component in Arduino, reacting to some physical world values by changing its environment and propagating the change as a basic message to its neighbors, to the now classic serial communication, electronic entities are talking among themselves and to us.

As with the many concepts in this book, we have already used serial communication and the underlying Serial protocol a couple of times as a black-boxed tool, that is, a tool I have introduced but not explained.

We are going to dive into it in this small chapter. We will discover that serial communication is used not only for machine-to-human communication but also for "component-to-component" discussions inside machines. By components, I mean small systems, and I could use the term peripheral to describe them.

Serial communication


Typically, serial communication in computer science and telecommunications is a type of communication where data is sent one bit at a time over a communication bus.

Nowadays, we can see serial communication all around us, and often we don't even realize this. J The "S" in the USB acronym means Serial (USB is Universal Serial Bus), and represents the underlying serial communication bus used by every higher protocol.

Let's dig into that right now.

Serial and parallel communication

Serial communication is often defined by its opposite form of communication, parallel communication, where several bits of data are sent out over a link made by several parallel channels at the same time. Look at the following figure:

Basic, unidirectional serial communication between a speaker and a listener

Now let's compare this to a parallel case:

Basic, unidirectional parallel communication between a speaker and a listener

In these two figures, a speaker is sending the following data byte: 0 1...

Multiple serial interfaces


I won't describe all the serial protocols, but I'd like to talk about some important ones, and sort them into families.

The powerful Morse code telegraphy ancestor

I give you one of the oldest Serial protocols: the Morse code telegraphy protocol. Telecommunications operators have been using this one since the second half of the 19th century.

I have to say that Samuel F. B. Morse was not only an inventor but also an accomplished artist and painter. It is important to mention this here because I'm really convinced that art and technology are finally one and the same thing that we used to see with two different points of view. I could quote more artist/inventor persons but I guess it would be a bit off topic.

By sending long and short pulses separated by blanks, Morse's operators can send words, sentences, and information. This can happen over multiple types of media, such as:

  • Wires (electrical pulses)

  • Air (electromagnetic wave carriers, light, sounds)

It can be sorted into...

Summary


In this chapter, we talked about serial communication. This is a very common mode of communication both inside and between electronic devices. This chapter is also a nice introduction to other communication protocol in general, and I'm sure that you are now ready to understand more advanced features.

In the next chapter, we'll use some of the different types of serial protocol that were introduced here. In particular, we are going to talk about Arduino outputs; this means that not only will we be able to add feedback and reactions to our Arduino boards, considering behavior pattern designs such as stimulus and response for deterministic ways, but we will also see more chaotic behaviors such as those including constrained chance, for instance.

lock icon The rest of the chapter is locked
You have been reading a chapter from
C Programming for Arduino
Published in: May 2013 Publisher: Packt ISBN-13: 9781849517584
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}