#BB11

  Рет қаралды 27,573

Ralph S Bacon

Ralph S Bacon

Күн бұрын

Пікірлер: 149
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why Жыл бұрын
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.
@RalphBacon
@RalphBacon Жыл бұрын
Nick Gammon (no relation) is indeed a guru for all things Arduino so I'm not surprised he came up with a novel solution. Great that you extended his idea. The best way of sharing such code / info is via GitHub (like I do), then everyone can see your endeavours.
@hiddevandijk143
@hiddevandijk143 4 ай бұрын
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.
@RalphBacon
@RalphBacon 4 ай бұрын
I'm delighted you did this! Congrats! Start small and then you can increase the complexity of your library (class). 👍
@ForwardGuidance
@ForwardGuidance Жыл бұрын
Do you know how elephants hide in a cherry tree, Ralph? They paint their toes nails red! Have you ever seen an elephant in a cherry tree? No? It works. Great video Ralph. You're on the top of the leaderboard.
@RalphBacon
@RalphBacon Жыл бұрын
And on the topic of OOP code, how do you eat an OOP elephant? One byte at a time, of course. 😁
@veedonfleece3694
@veedonfleece3694 Жыл бұрын
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!
@RalphBacon
@RalphBacon Жыл бұрын
Glad it's helping you!
@gerardstrik2555
@gerardstrik2555 Жыл бұрын
This is very helpful. Just what I was looking for. Thanks for the clear explanation Ralph.
@RalphBacon
@RalphBacon Жыл бұрын
You're very welcome!
@dougbarber600
@dougbarber600 Жыл бұрын
Always had trouble understanding C++ objects they now make a lot more sense. Many Thanks Ralph
@RalphBacon
@RalphBacon Жыл бұрын
Objects are shrouded in mystery but for no good reason.
@electronics.unmessed
@electronics.unmessed Жыл бұрын
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. 👍👍👍
@RalphBacon
@RalphBacon Жыл бұрын
You're very welcome!
@OtusAsio
@OtusAsio Жыл бұрын
Friday is my "neardy!" day...always look for your video... Thank you!
@RalphBacon
@RalphBacon Жыл бұрын
Yay! Thank you! Hang on, you saying I'm a nerd, Pierre?
@OtusAsio
@OtusAsio Жыл бұрын
@@RalphBacon I would not say something to offend you of course that is why I said "my nerdy day"😀
@doverivermedia3937
@doverivermedia3937 Жыл бұрын
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 .. 🇬🇧
@RalphBacon
@RalphBacon Жыл бұрын
You can do it! Even if your "library" contained just one function to print "Hello World" then you would have a library. But I can understand that it might be somewhat overwhelming for a self-confessed newbie... all in your own time!
@pekkagronfors7304
@pekkagronfors7304 Жыл бұрын
Yes! Today I watched your movie for the first time in the highest resolution, before the playback was hacking and lagging all the time. I got an old written off ThinkPad X1 Carbon 7th i7/16GB from work.
@RalphBacon
@RalphBacon Жыл бұрын
It's "only" HD not 4K! What were you using before, a Sinclair Spectrum? 😲😁🤣 But I'm happy you can now see it in full definition.
@pekkagronfors7304
@pekkagronfors7304 Жыл бұрын
@@RalphBacon I used the Swedish Luxor ABC 80. Ha, ha not. I used an old iMac running Win 7 in Bootcamp. I have used it for many years, 10+, but now it had to retire. The difference is staggering in performance.
@noweare1
@noweare1 4 ай бұрын
Excellent Ralph, I have been wanting to get more familiar with libraries but do not know C++. This is a very good starting point though.
@RalphBacon
@RalphBacon 4 ай бұрын
Glad you are finding it useful.
@ReflectingMe2024
@ReflectingMe2024 Жыл бұрын
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)
@RalphBacon
@RalphBacon Жыл бұрын
Sounds very interesting (not to mention, complex) stuff you're working on, John. And, yes, I do remember you, I'm very happy you're still here on my Arduinite journey! 👍
@gpTeacher
@gpTeacher Жыл бұрын
Instructive as always Ralph! Thank you kindly!
@RalphBacon
@RalphBacon Жыл бұрын
Glad it was helpful!
@andymouse
@andymouse Жыл бұрын
Great explanation Ralph, I will need to run through this a few times !...cheers.
@RalphBacon
@RalphBacon Жыл бұрын
Glad it was helpful!
@TheOleHermit
@TheOleHermit 11 ай бұрын
Very hoopie-cool, Ralph! An Arduino that's millennia faster than Deep Thought! 😎
@RalphBacon
@RalphBacon 11 ай бұрын
Indeed it is!
@grahamheath3799
@grahamheath3799 8 ай бұрын
Classes and arduino libraries are beginning to make sense
@RalphBacon
@RalphBacon 7 ай бұрын
I'm glad, because the power of object oriented programming cannot be underestimated. But start with baby steps first!
@roberto660
@roberto660 Жыл бұрын
Hey mr. Bacon, thank you so much for this video and for explaining how to build a library, much appreciated
@RalphBacon
@RalphBacon Жыл бұрын
You're very welcome!
@greg4367
@greg4367 Жыл бұрын
Totally productive and useful video. Thank you.
@RalphBacon
@RalphBacon Жыл бұрын
Glad you enjoyed it!
@SevMamba
@SevMamba 8 ай бұрын
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.
@RalphBacon
@RalphBacon 8 ай бұрын
Yes, Sev, some comments can be less than constructive, for sure! Onto your question. In your 'sketches' folder is another folder called 'libraries'. In _that_ folder are all your library folders. Create a new library folder there and pop in your library files (.h and .cpp files) and they will be global and found by the Arduino IDE/compiler. So there's no "installation" as such, just a copy process. Ensure you only have the library accessible to the Arduino IDE in ONE place or it will possibly pick up the wrong version.
@basiljackson3829
@basiljackson3829 Жыл бұрын
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!
@RalphBacon
@RalphBacon Жыл бұрын
Thanks for the sub, Basil. 👍I'll try and watch (and control) the hand waving in future (I just get carried away 😁).
@williammiller7543
@williammiller7543 Жыл бұрын
Another Great video, I've wanted to look into to libraries and this was a great starter. Thanks.
@RalphBacon
@RalphBacon Жыл бұрын
Glad you enjoyed it!
@Telectronics
@Telectronics Жыл бұрын
You explain it really well thank you very much ! 👍
@RalphBacon
@RalphBacon Жыл бұрын
You are welcome!
@PeteTheProps
@PeteTheProps Жыл бұрын
A very useful demo thank you for that.
@RalphBacon
@RalphBacon Жыл бұрын
Glad it was helpful!
@tseckwr3783
@tseckwr3783 Ай бұрын
Thanks Ralph.
@RalphBacon
@RalphBacon Ай бұрын
Most welcome!
@keitholiver3981
@keitholiver3981 Жыл бұрын
Thanks for the interesting topic on libraries, got me thinking how to change my project.
@RalphBacon
@RalphBacon Жыл бұрын
Glad it was helpful! Deffo worth experimenting with a simple library first and see how you get on (spoiler: brilliantly).
@JamesFraley
@JamesFraley Жыл бұрын
Your lessons are always the best!
@RalphBacon
@RalphBacon Жыл бұрын
Wow, thanks, Jim!
@SpinStar1956
@SpinStar1956 Жыл бұрын
Thanks Ralph! Nice explanation...
@RalphBacon
@RalphBacon Жыл бұрын
Glad you liked it!
@b3nd0v3r28
@b3nd0v3r28 Жыл бұрын
Yoo, b-word! Glad to see Mr White moved on from methamphetamine production to embedded programming
@RalphBacon
@RalphBacon Жыл бұрын
Well, [re-reads post for umpteenth time trying to understand it], yes, absolutely! 😁😉😲
@danman32
@danman32 9 ай бұрын
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!
@RalphBacon
@RalphBacon 9 ай бұрын
I will have to change that to say "Try them out soon!" 😁
@grahamnichols1416
@grahamnichols1416 6 ай бұрын
REALLY helpful. Liked and subscribed.
@RalphBacon
@RalphBacon 6 ай бұрын
Awesome, thank you!
@kevingpearce
@kevingpearce Жыл бұрын
Thanks Ralph, I'm an avid follower of all your videos, great work. However, I'm a bit confused about how you arrived at the screen showing 3 tabs open at the top (minute 5:09). How do you actually begin to write your library ? I assume it's not from within the Arduino IDE, as that saves any sketches automatically with .ino extensions ? Confused is me.
@RalphBacon
@RalphBacon Жыл бұрын
Dear confused 😲 Yes, you can indeed use the Arduino IDE. On the top row with the single .ino tab, there is (on the right hand side) a drop down three dots (using Arduino 2.0.2) from which you can select "New Tab". Give it (the new file) a name, such as "MyLibrary.cpp" and it will place it in the same folder as your .ino file. It will also open it when you next open the .ino file too, so helpful! Does this answer your query, Kevin?
@kevingpearce
@kevingpearce Жыл бұрын
@@RalphBacon Thanks Ralph. A brilliant and concise answer providing immediate clarity. I never looked behind those 3 dots before.
@joelmelan6394
@joelmelan6394 Жыл бұрын
Thank you for this very good tuto ! I have a question : just suppose you have 2 models of arduino (mega and esp32 for instance) and 2 types of displays (LCD and OLED for instance). Please, how will you dispatch code between libraries and main file in order to manage all the 4 cases of configuration ?
@RalphBacon
@RalphBacon Жыл бұрын
You would need definitions that determine which part of the library you need. This is done all the time by those that create libraries for 20 different screen for example. So the developer (you & me) would edit one of the files to uncomment the correct screen type definition (eg ILI9341) and within the library header there would be #ifdef statements that only spring into life when a particular variable has been declared. This ensures that you your sketch does not contain all the code for 19 different screen types that you will never use. All the code that does not get exposed as part of the #ifdef statement will never get compiled. Here's a Real World extract from one the libraries I use: // Only define one driver, the other ones must be commented out #define ILI9341_DRIVER //#define ST7735_DRIVER // Define additional parameters below for this display //#define ILI9163_DRIVER // Define additional parameters below for this display //#define S6D02A1_DRIVER //#define RPI_ILI9486_DRIVER // 20MHz maximum SPI //#define HX8357D_DRIVER //#define ILI9481_DRIVER //#define ILI9486_DRIVER //#define ILI9488_DRIVER
@bob-ny6kn
@bob-ny6kn Жыл бұрын
In your other "create library" video you added a keywords.txt file. Is a created keyword in danger of conflicting with the same keyword created by a #include (another abstraction) or will compilers identify and warn about the conflict?
@RalphBacon
@RalphBacon Жыл бұрын
The keywords file doesn't warn you of anything, not even spelling mistakes. 😲 It's just eye-candy for the IDE you are using (but useful eye candy, nonetheless). Compiler ignores it completely. I don't think one list of keywords will conflict with other libraries because the keywords.txt file is in the library folder to which it pertains.
@jenniferw8963
@jenniferw8963 Жыл бұрын
Great video :) I've been learning C++, coming from Java. Something that is weird is when you have classes as members of another class, you are forced to create a parameterless constructor. When the class is declared as member it instantiaties. Then the constructor of the class it is in, will have to again call the proper parameterized constructor. Actually had to modify several existing classes adding empty constructors. A bit annoying.
@RalphBacon
@RalphBacon Жыл бұрын
You mean Java is no longer the blue-eyed boy on the block? 😲😁 You'll be coding in Python next 🤮
@jenniferw8963
@jenniferw8963 Жыл бұрын
@@RalphBacon Yuck @ Python. Actually Java is really good; very clean code and typed unlike Python. I do like C++ but it's weird having to call empty constructor which leaves class in an unusable state until it is called again with the proper parameterized constructor.
@joseph9915
@joseph9915 Жыл бұрын
I found this video interesting, thanks. I realize this is kind of off-topic but if I was trying to save every byte of memory possible, then for example would you get 8 copies of "_digits" if you had 8 copies of the class or would the linker optimize it? (For say a DRO for CNC where you might need 1 for each of 7 axis + more for other stuff.)
@RalphBacon
@RalphBacon Жыл бұрын
Not off topic at all, actually, Joseph. Yes, in that use case you would repeat everything in the "private" section. However, there are ways round that to ensure each instance uses a "static" version of the "_digits" (known as a singleton) but that's not beginner-friendly stuff. Better for beginners to use a few more bytes and get it working.
@HelmutFischer-thehefi
@HelmutFischer-thehefi Жыл бұрын
Very well done! But: where is the decimal point when running the sketch?
@RalphBacon
@RalphBacon Жыл бұрын
Did the sketch output a DP, I can't remember? All the DP bit does is add an additional "1" bit at the end (LSB) for the 8th segment. I'll check that it's working when I next use it.
@ronycaballero4409
@ronycaballero4409 Жыл бұрын
Very useful !!. Thanks a lot!
@RalphBacon
@RalphBacon Жыл бұрын
Glad it was helpful!
@danman32
@danman32 9 ай бұрын
You appear to have a bug in your value checking in updateValue method. When inputting a value to display in hex, you're checking if the value is greater than 256. Should be 255 since 256 is not valid for only 2 hex digits.
@RalphBacon
@RalphBacon 9 ай бұрын
Really?!? Obvs a typo and I hope I haven't confused anyone! Well spotted!
@maxpenfold8699
@maxpenfold8699 Жыл бұрын
Very nice explanation thank you.
@RalphBacon
@RalphBacon Жыл бұрын
Hey, Max, Merry Christmas! 🧑‍🎄Thanks for your kind words!
@joymakerRC
@joymakerRC Жыл бұрын
thank you again Mr. Bacon, luv your face.
@RalphBacon
@RalphBacon Жыл бұрын
My old face, I think you mean, Bill. 👴
@WagonLoads
@WagonLoads Жыл бұрын
I want to thank you for all of your help. I still don't grasp everything yet, but you have explained everything very well. I will just have to watch this a few more times. I just recently bought a esp32-S3 T-Display. I can access it, but it can't find my libraries DIR. I made one major mistake when pasting the git json url in the preferences window. When I pasted the url into the window, I accidentally deleted the previous json urls. Did that make the Arduino forget where my libraries DIR is.. or worse, did it delete the original libraries DIR? it was originally in a path starting with a dot followed by arduino15 Is there a master list of json urls for the arduino IDE preferences window? (board definitions)??
@RalphBacon
@RalphBacon Жыл бұрын
Your Arduino _libraries_ folder usually resides in the same folder as all your sketches. Eg C: > Document > Arduino Sketches > libraries Have a look to see whether you can find it in the trash otherwise, from where you can restore it. The "master list" of json URLs doesn't really exist but mine looks like this: ``` arduino.esp8266.com/stable/package_esp8266com_index.json dan.drown.org/stm32duino/package_STM32duino_index.json digistump.com/package_digistump_index.json drazzy.com/package_drazzy.com_index.json adafruit.github.io/arduino-board-index/package_adafruit_index.json dl.espressif.com/dl/package_esp32_index.json github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json mcudude.github.io/MicroCore/package_MCUdude_MicroCore_index.json mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json raw.githubusercontent.com/dbuezas/lgt8fx/master/package_lgt8fx_index.json raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json raw.githubusercontent.com/mikaelpatel/Cosa/master/package_cosa_index.json raw.githubusercontent.com/sleemanj/optiboot/master/dists/package_gogo_diy_attiny_index.json raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json ``` There could be some duplicates and experimental devices in that list, so you should be selective!
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist Жыл бұрын
I would have written the library as a generic library to drive a 47HC595. In the set up routine I would have data for pins used, display type, non-display just I/O, number of attached devices- so you can link more than one. etc, etc But the important point that should be made is when you update the library the new one should be backwards compatible. I've given up using Arduino libraries due to this. Having to find a version of the library that works with the code you're looking at, as the latest one just does not work. and the author does not reference the version of the library used.
@RalphBacon
@RalphBacon Жыл бұрын
I hear you about backward compatibility (or lack of it). Many of my Arduino sketches failed on recompile after a few years due to this. That's why I use VSC (PlatformIO) so I can use specific versions of a library, if required. Or even keep a snapshot of the actual library with the project. Makes life a lot easier.
@grunto666
@grunto666 Жыл бұрын
@@RalphBacon How do you add a library that you have created to VSC / PlatformIO?
@igrewold
@igrewold Жыл бұрын
Good work, thanks man.
@RalphBacon
@RalphBacon Жыл бұрын
You're welcome!
@hugbearsx4
@hugbearsx4 Жыл бұрын
Is the use of classes in Arduino libraries mandatory? Is it possible to use #include files as collections of standalone functions, just like normal beginners? Is this video a trick to lure unsuspecting Arduiners into the wonderful world of OOP? 😁 Excellent presentation, btw. Thanks!
@RalphBacon
@RalphBacon Жыл бұрын
Dang, you discovered my subterfuge! But seriously... The #include file can contain anything that syntactically fits into the place in your sketch (as though you had typed the contents of the #include file right there). So it can include functions that are logically grouped, perhaps. I showed how to organise code better in videos #BB9 and #BB10 which includes this technique. kzbin.info/www/bejne/hoiwgJVuarR6j5I kzbin.info/www/bejne/hmGziqSrbZiGmbs So, long answer to a short question: you don't need to include a class in an #include file!
@ChrisBalmforth
@ChrisBalmforth Жыл бұрын
This made me consider re-writing large chunks of my line follower robot code as a robot library. Hmmm!
@RalphBacon
@RalphBacon Жыл бұрын
Yes, do it. Perhaps more than one library (separation of concerns). 👍
@steverileyretired
@steverileyretired Жыл бұрын
Very good, thanks
@RalphBacon
@RalphBacon Жыл бұрын
My pleasure!
@danny12345
@danny12345 Жыл бұрын
Thank you very much for the beautiful explanation. I have a question Can you show a video on the difference between accessing a class through dynamic memory and static memory when we address the class as you wrote and when do we address the class through the word new in arduino And when we write the destructor when we opened dynamic memory in the Arduino program .
@RalphBacon
@RalphBacon Жыл бұрын
A tricky subject at the best of times, Danny. The question I would ask is Why on earth are you worried about Heap vs Stack memory allocation? Using the "new" keyword puts the object on the (larger) heap memory but then you must explicitly delete the object to free up the memory (or you get a memory leak). Using smart pointers goes a long way to prevent this but even so... Not using "new" keyword (the default way, I guess) means the item goes on the stack (limited memory, agreed) but you don't have to manually manage it; it will be automatically removed (the memory freed) when the object or variable goes out of scope (eg a function finishes). Unless you have a _a very good reason_ to use "new", don't. Some good reasons might be: * you have a large object or array that would cause a stack overflow (or otherwise impair the operation of the rest of the code because there is insufficient stack memory * you want a pointer to the object returned (but note my comment about smart pointers) * you need to resize a variable (eg array) and therefore it can't really go on the stack which only allows fixed sized variables (apart from vectors which does all the hard work behind the scenes) Unless you want memory leaks, don't directly call "new" and "delete" from your sketch. Wrap such objects in a class so that the "delete" function is automatically called when it goes out of scope. As I say, a tricky subject at best of times.
@danny12345
@danny12345 Жыл бұрын
@@RalphBacon Thank you very much for your answer, I really appreciate the demonstrations that teach Arduino programming through the programming language C++
@Henry-sv3wv
@Henry-sv3wv Жыл бұрын
On Microcontroller: Dynamic memory bad. Avoid if you don't know what you do. Danger of Memory Fragmentation. (of couse use new and delete if you want to try stuff out but know why stuff can go bad and should be avoided) (at least dynamic memory bad on these small ATmega with only 2KB RAM) but i guess some arduino libraries use dynamic memory to like allocate a buffer and never free the space in the runtime ...
@Roy_Tellason
@Roy_Tellason Жыл бұрын
I got into c some years back, never got into c++. Perhaps it's time to give it a go...
@RalphBacon
@RalphBacon Жыл бұрын
If you know C you can migrate to C++ because it still allows a lot of C constructs and methods.
@ElieWar
@ElieWar Жыл бұрын
Thank you
@RalphBacon
@RalphBacon Жыл бұрын
You're welcome!
@__--JY-Moe--__
@__--JY-Moe--__ Жыл бұрын
that Bacon, he's a ''slick'' one!! that Bacon, U can use his Technics on about anything! that Bacon, add L&T. & u've got a meal! that Bacon,🖖. cause I'm not genius!🤣
@RalphBacon
@RalphBacon Жыл бұрын
You got that right! Mmm, BLT (especially when the Bacon is sizzling) 🥓😋
@jstro-hobbytech
@jstro-hobbytech Жыл бұрын
Think function overloading using a template or literals for each port to speed up the code a little would work?
@RalphBacon
@RalphBacon Жыл бұрын
Function overloading won't _speed up_ the code, but it would make it easier for a developer (me & you) to just pick a named function and use it.
@jstro-hobbytech
@jstro-hobbytech Жыл бұрын
@@RalphBacon haha I'm but a grasshopper my friend. I've never written production code. I just read alot of books and make silly apps haha
@mariusscheepers9003
@mariusscheepers9003 Жыл бұрын
Can you please consider doing a few Rust on Arduino videos.
@RalphBacon
@RalphBacon Жыл бұрын
The question I have to ask is, " How many of my viewers program in Rust? On an Arduino? Or want to?" I'm pretty sure it must be very low.
@mariusscheepers9003
@mariusscheepers9003 Жыл бұрын
@@RalphBacon I agree. Its very interesting but not that popular under Arduino users.
@fredflintstone1
@fredflintstone1 Жыл бұрын
I was with you when you said "yes Indeed" after that it all went OOP's 😟
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist Жыл бұрын
That's because you're just an old Woofer Fred. ;-)
@fredflintstone1
@fredflintstone1 Жыл бұрын
@@TheEmbeddedHobbyist Meow!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@RalphBacon
@RalphBacon Жыл бұрын
So you got past "Welcome Back" and "Yes, indeed". 🎉🎊🎈 I suppose the "instantiation of a blueprint class into an object" was just one step too far? 😟
@fredflintstone1
@fredflintstone1 Жыл бұрын
@@RalphBacon damn big words as well very Perspicacious of you 🙂
@jyvben1520
@jyvben1520 Жыл бұрын
maybe Bambam can explain it to you ...
@joaquingutierrez3072
@joaquingutierrez3072 5 ай бұрын
Amazing
@RalphBacon
@RalphBacon 5 ай бұрын
Thank you! Cheers!
@rfdave3980
@rfdave3980 Жыл бұрын
I like Bacon.... Thanks Ralph
@fredflintstone1
@fredflintstone1 Жыл бұрын
with Eggs of course 🙂
@RalphBacon
@RalphBacon Жыл бұрын
You are welcome RFdave!
@reoproedros
@reoproedros Жыл бұрын
after unbearable thinking , i found a name to propose for the device , "the debugun" (the debugging has began )
@RalphBacon
@RalphBacon Жыл бұрын
Wow! You should definitely patent that name, quickly!
@joaoarriagaecunha8583
@joaoarriagaecunha8583 Жыл бұрын
Hi, thanks for your video but you didn't explain the most important part of the process. I am not very interested in the internals of your class. What I am interested in is learning things like these: 1. Where do you get and put the arduino.h file to include in your class code? And the corresponding library? 2. Once complete, how do you install your library in the Arduino environment so we can use it in our sketches? 3. What really do you install in the Arduino environment? Is it the source code of your class? Is it the compiled version of your code? 4. I see you were using Visual Studio to make your class. Is the compiled code of Visual Studio C++ compiler compatible with Arduino compiler? 5. Why do you code your library in Visual Studio and not in the Arduino editor? Does it have to be like that? You cannot write libraries in the Arduino editor and environment?
@RalphBacon
@RalphBacon Жыл бұрын
Oh no! You must have been sleeping, João! I explained all this in the video. Look: 1. The .h file (and the associated .cpp) are created as new files by using the 3-dots button in the IDE. They are all placed in the same folder automatically as your sketch, whilst you work on them. 2. Once you have it (the library) ready for wider consumption, create a new library folder (ideally of the same name, as I mentioned in the video) in the _libraries_ folder which you will find in your Arduino sketches folder. Arduino Sketches -> libraries -> MyLibrary -> myLibrary.h & myLibrary.cpp 3. Nothing is _installed_ as such. Just the .h and .cpp files in their folder in the libraries folder. Then you just #include in whatever sketch you want! The library is compiled for each sketch that needs it and is included in the final code for the target device. 4. Visual Studio Code (PlatformIO) uses the same gcc-avr compiler as the Arduino IDE (and now both IDEs look more similar, too, since Arduino IDE 2.0.2). Did I miss anything? Let me know! And good luck!
@joaoarriagaecunha8583
@joaoarriagaecunha8583 Жыл бұрын
@@RalphBacon Sorry for being asleep...... Meanwhile I discovered another video of yours where you explain all that. Thanks a lot for the help!
@Henry-sv3wv
@Henry-sv3wv Жыл бұрын
The c++ compiler would call a library something that is compiled into a library and stuff but arduino says: a library is a source code that is programmed in a way that you can put it in the arduino library folder so you can use it as an arduino library.
@thepvporg
@thepvporg Жыл бұрын
I am still trying to wrap my head around the lack of alternative coding languages and compilers for Arduino thats been out for 10 years now. I hated C and hate C++ as there is a lot of unnecessary fidgeting to write a simple program. There are far better languages out there that would make Arduino accessible, there is no reason why people can't use languages that they are used to, example, I left Delphi C behind in 1995, just like C++ it is cumbersome and pedantic, you have to do a lot of work for such a simple task that it makes Arduino and it's ilk fail the rapid development test. I have been campaigning in the Arduion forums for years, had 7 or 8 accounts deleted by them as they just don't want to listen to good reasoning to make Arduion more accessible, they instead want people to spend hours upon hours of writing redundant elements that should be automatic like an array... JavaScript : jsArray = [1,2,3,4,5,6]; C++ : int cppArray [6] = {1,2,3,4,5,6}; If you suggest that there is a JavaScript (the easiest language to learn) then you get all sorts of comments about how it is not suitable or "Powerful enough"£ when these muppets fail to understand that the front end is only as powerful as the compiler. It is my considered opinion that a JavaScript (not Java) front end and compiler would make Arduino more accessible as more people know JavaScript than C++ I have given up on C++ and I await a more user friendly front end that has a compiler that does all the housekeeping and compiles in to something that the Atmel chip can use. Maybe when Arduino wake up to this fact that they will be making their product more accessible, they will soon see a huge surge in demand for it, they don't seem to see that many people trying to learn C++ struggle because its not an easy language to use and you have to take care of memory allocations, pointers and flushing buffers and mopping up after you're done. Atmel would also do themselves a big favour by putting the whole memory space available for use rather than having to specifically and write special code to access the higher memory spaces, why make things hard?
@RalphBacon
@RalphBacon Жыл бұрын
In which case you'll be pleasantly surprised that the Arduino IDE now supports microPython, albeit in the early stages yet. See bit.ly/3VzTRu5
@Henry-sv3wv
@Henry-sv3wv Жыл бұрын
Arduino with ATMega328p: 2KB RAM ... but you're welcome to write a python interpeter for it. cause i like python, too ...
@Henry-sv3wv
@Henry-sv3wv Жыл бұрын
And everybody agrees with me that if i say: "javascript sucks" that it is not a number. kzbin.info/www/bejne/p6epeGuAbLiIeqc
@デク-b7j
@デク-b7j Жыл бұрын
@@RalphBacon It's kinda limited (as opposed to CPython in Linux or Windows).
@yogeshitaliya473
@yogeshitaliya473 Жыл бұрын
🥰🥰🥰
@RalphBacon
@RalphBacon Жыл бұрын
First again, like a coiled spring, Yogesh!
@DrexProjects
@DrexProjects Жыл бұрын
My brain hurts.
@RalphBacon
@RalphBacon Жыл бұрын
Funnily enough so does mine. I blame that bottle of Scotch from last night, what's your excuse? 😁
@DrexProjects
@DrexProjects Жыл бұрын
@@RalphBacon My lack of neurons to remember things of importance. And Ballantine's.
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why Жыл бұрын
Of course you are correct Ralph, and I mean to do this some time, but I've just not quite wrapped my head around github yet. In the meantime, here's a googledrive link to some stuff: drive.google.com/drive/folders/1Ba3jRfbYRE5geXDQd1XrxaZvgdlixG03?usp=share_link I've included KiCad files, so everyone can see what I mean about the anatomically correct symbols, and also some demo Arduino code. This is pretty old stuff, but I've just tested it to make sure everything still works. It does. Cheers, Richard
@RalphBacon
@RalphBacon Жыл бұрын
"Anatomically correct", you say? Ha ha! Yes, I see the design goal here but if I might suggest that you could shrink the PCB to less than half its size if you put the chips either _under_ each display or on the other side of this _double-sided_ board? Just a suggestion. And if you use the SMD version of the PCB pin headers I showed then you could put the pins on the "other side" two too, and thus have a very clean board with little more than the display visible on one side. Thanks for sharing this, I like the code style, very clean, well documented too.
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why Жыл бұрын
@@RalphBacon Thanks and yes, of course. This was a long time ago and was just a proof of concept even then. The reason for using DIP components btw, was to place sockets on the board and swap out common anode for cathode, to prove that this worked. But today I'd use SMD and probably place the ICs on the other side of the board. I'd also add transistors and not drive the displays directly from the mcu.
@qzorn4440
@qzorn4440 Жыл бұрын
This is amazing as about 10 days ago I was curious about making an Arduino library for a Modbus esp32 project board with so - so how to information to find and get working. "For Me?" For the learning curve this video will help: $23 LILYGO T-CAN485 ESP32 Development Board CAN Modbus RTU RS485 IoT Engineer Control Module with cellphone free RemoteXY. 😎 Thanks a lot.
@RalphBacon
@RalphBacon Жыл бұрын
I'm glad it arrived at the right time for you!
@qzorn4440
@qzorn4440 Жыл бұрын
@@RalphBacon Thanks.
@tseckwr3783
@tseckwr3783 Жыл бұрын
Thanks Ralph.
@RalphBacon
@RalphBacon Жыл бұрын
You're most welcome!
ESP32 Devkit + Display 3.5" SPI Raspberry pi
3:59
FBELLSAN - Informatica
Рет қаралды 860
Mom had to stand up for the whole family!❤️😍😁
00:39
"كان عليّ أكل بقايا الطعام قبل هذا اليوم 🥹"
00:40
Holly Wolly Bow Arabic
Рет қаралды 9 МЛН
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 2,6 МЛН
The best way to start learning Verilog
14:50
Visual Electric
Рет қаралды 131 М.
#71 How to create an Arduino Library - easy!
38:14
Ralph S Bacon
Рет қаралды 172 М.
I tried the 3 Cheapest Arduino Alternatives! (That you Suggested)
13:21
Arduino OOP [40-Minute Crash Course]
42:12
Robotics Back-End
Рет қаралды 20 М.
#BB9 Organising your code🧹for easier debugging and maintenance✅
18:45
#BB7 Pass by Value or Reference - What's the difference?
16:35
Ralph S Bacon
Рет қаралды 13 М.
Create an Arduino Library (Step by Step)
19:41
Robotics Back-End
Рет қаралды 43 М.
Every Developer Needs a Raspberry Pi
27:27
Sam Meech-Ward
Рет қаралды 750 М.