Book Image

C Programming for Arduino

By : Julien Bayle
Book Image

C Programming for Arduino

By: Julien Bayle

Overview of this book

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.
Table of Contents (21 chapters)
C Programming for Arduino
About the Author
About the Reviewers

Creating a sound-level meter with LEDs

This small project is a typical example of a Max 6/Arduino hardware and software collaboration.

Max can easily listen for sounds and convert them from the analog to the digital domain.

We are going to build a small sound level visualizer using Arduino, some LEDs, and Max 6.

The circuit

We are going to use the same circuit we designed in Chapter 8, Designing Visual Output Feedbacks, while we multiplexed LEDs with a daisy chain of shift registers of the type 595.

The following figure shows the circuit:

Our double series of eight LEDs

Our double series of eight LEDs

The basic idea is to:

  • Use each series of eight LEDs for each sound channel (left and right)

  • Display the sound level all along the LED series

For each channel, the greater the number of LEDs switched on, the higher the sound level.

Let's now check how we can handle this in Max 6 first.

The Max 6 patch for calculating sound levels

Have a look at the following figure showing the SoundLevelMeters patch: