Write your own drivers for Arduino

Lead Image © studiostocks, 123RF.com

Easy Driver

So, you have some new kit for your Arduino – maybe some sensors or ICs – but programming them is clumsy and painful. Don't despair: You can make your life easier by writing your own drivers!

Writing drivers (or libraries) for Arduino is not hard – quite the contrary. And, it can make your sketches clearer and reduce the line count considerably. Consider the driver for the MC14051B [1] in this article, for example.

I talked about this little critter in a previous article [2] (which you may want to read before tackling this one) and how it's easy for Arduino sketches to get out of hand because of the number of lines you need for even the simplest of set ups.

As mentioned previously, the MC14051B (Figure 1) gives you eight analog ports that you can connect to from one analog pin on your Arduino (Figure 2). You will also have to use four digital pins: three to tell the MC14051B which of its eight ports you're going to use (using binary), and one for the inhibitor pin that you use to reset the chip. Yet, eight analog ports in exchange for one analog and four digital pins is still a bargain.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content