#BB11 Create an Arduino Library😨 - A Real World Example (Easy)

preview_player
Показать описание
We use libraries all the time - even the Arduino framework is a library!

Writing a library is straightforward if you follow the simple pattern that I demo here. I show you a Real World library that controls a bit of hardware that I had on my workbench - but you can write one for ANY piece of hardware.

We'll even talk about elephants (the one in the room) and why we should not be fearful about simple things like 'objects' - watch the video and judge for yourself. 😉

Yes, a library can take the complexity of coding away from your sketch so that it (and future ones) "just work" by calling a library.

► The two-digit, common anode, 74HC595-driven display I used in the video (widely available):

► More information (including pictures, all links, sketches & PDFs in my GitHub):

► List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)

► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey

My channel, GitHub and blog are here:
------------------------------------------------------------------
------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

Just wrote my first library after seeing this video a few times. Never understood it before, but now it starts to make sense. Thank Mr Bacon.

hiddevandijk
Автор

Thankyou once again for a clear explanation.
As a non programmer, who knows bits about all parts of this stuff, it really ties it together in an ordered and efficient way. Well done!

veedonfleece
Автор

Classes and arduino libraries are beginning to make sense

grahamheath
Автор

Thank you very much for that video about libraries. Since I am a somebody who is just applying them, it helps me a lot to better understand how they work. 👍👍👍

electronics.unmessed
Автор

Morning Ralph. You may (or probably may not) remember I sub'd to your channel many years ago, and a few years after that I contacted you after a clear out of my overwhelming volume of YT sub'd channels, kept yours in my list. (In case you're curious, I contacted you regarding a central heating control question). Anyway, you are still very much in my list and I just watched this one and must say, very nicely explained sir. Classes are a topic that confuse many people, myself included, and you make the process very clear. Keep up the great work.. PS: I am currently working with M5Stack and LilyGo T-Display devices - both of which you may find extremely useful in your line of work. Currently connecting a T-Embed device with built in rotary encoder via WiFi to my SunSDR2DX Amateur Radio transceiver to control it via the manufacturers TCT Protocol. All super stuff! John (GW3JVB)

ReflectingMe
Автор

Friday is my "neardy!" day...always look for your video... Thank you!

OtusAsio
Автор

Wow, I've just read the comments sections from a couple of your videos and I'm absolutely gobsmacked at how some people are arrogant and disrespectful of your work, if they want to view videos for super experts as they claim they are, why make such terrible comments, just say this channel is not for me and move on. Personally although I have been "hobby" coding for over 50 years, Fortran77, Cobol, Basic on the Sinclair Spectrum, MS Basic, Visual Basic etc, but never cpp, I like the level you are aiming at, so please keep doing what you are doing. Now to the issue that made me write this. For me the video stopped one minute early, or perhaps could be the subject of another video. How do I install MY library?, I've done searches of my folders and find arduino and platformio libraries all over the place. I want MY libraries to be global for me so if I update them the new version will be used everywhere. I see the need for version control for third party libraries but not mine. The more I look into it, the more a don't understand, so perhaps a video on libraries how they differ from Arduino ide and platformio (I've converted to platformio) how to use "project" libraries and how to use global libraries (as in Ardunio). Sorry for the long post, get well and stay well. Sev.

SevMamba
Автор

Must admit Ralph, this one I'm struggling with and over my head as a newbie to micro electronics. Bookmarked until I'm further along with my 'vertical' learning curve, hehe .... Constructing your own library really makes sense though, and you've produced a uniquely comprehensive, excellent video as always .. 🇬🇧

doverivermedia
Автор

Great explanation Ralph, I will need to run through this a few times !...cheers.

andymouse
Автор

Totally productive and useful video. Thank you.

greg
Автор

I have now watched a good number of your videos. Initially, I found your presentation to be a bit distracting (lots of hand motion). However, I eventually came to appreciate the professionalism and quality of the information enough to ignore the hands. 🙂
This one was the icing on the cake and made the decision easy. New Subscriber!

basiljackson
Автор

You explain it really well thank you very much ! 👍

Telectronics
Автор

A very useful demo thank you for that.

PeteTheProps
Автор

Very hoopie-cool, Ralph!
An Arduino that's millennia faster than Deep Thought! 😎

TheOleHermit
Автор

Hey mr. Bacon, thank you so much for this video and for explaining how to build a library, much appreciated

roberto
Автор

Another Great video, I've wanted to look into to libraries and this was a great starter. Thanks.

williammiller
Автор

Thanks for the interesting topic on libraries, got me thinking how to change my project.

keitholiver
Автор

A long time ago I was playing around with 7-seg displays and 595 chips to drive them. I came across something that Nick Gammon had done, which seemed rather brilliant. Nick had a (multiplexed) design for driving a 3-digit display. I extended this to 8-digit displays. Basically:

There are (up to) 16 pins on the 7-seg displays; 8 for the digits and 8 for the segments. And on 2x595s there are 16 parallel output pins. So, what Nick did in his schematic, was to use what I refer to as 'anatomically correct' device symbols, (where the symbol pin positions match the physical device.) He placed these in his schematic and basically drew the shortest connections between pins. Brilliant. Most people would designate one of the 595s for 'digits' and the other for 'segments', (and probably also map them in order, e.g. data pin 0-7 to seg A-G+DP etc.) But it really doesn't make any difference to the circuit. Nick's way vastly simplifies the pcb layout, because you don't have a tangled mess of traces to sort out. Then in software, he simply 'mapped' the 16 595 pins to the corresponding 16 7-seg pins.

This is actually a pretty powerful principle which can be employed for other things beyond 7-seg displays. It can be a bit confusing, but you only need to do it once.

I have some of my own code if you're interested.

YoutubeBorkedMyOldHandle_why
Автор

I find it funny when at the end of your sponsorship you say "try them out now." Well then if they do that, they'll have to stop watching the video!

danman
Автор

This made me consider re-writing large chunks of my line follower robot code as a robot library. Hmmm!

ChrisBalmforth