Not a single book or any professional course explains it like this. This the best.
@km077 Жыл бұрын
As always: Dave comes by and everyone finally understands. Many thanks, Dave!
@uweri_38515 жыл бұрын
Thank you Dave for these tutorial. For me very helpful. Hope we get many more of these tutorials.
@queenidog14 жыл бұрын
You did a good job. Easy to understand. Never knew what this OOP was before, now I do.
@7Trident32 жыл бұрын
Thanks for the clear concise lesson. THIS is how teaching is done.
@bradywilson11772 жыл бұрын
Thanks dude!!! I really appreciate you going slow with what you are explaining
@samdeur3 жыл бұрын
Thank you very much... as a 46yr guy trying to wrap my head around classes and object i thought i would search how to create an Arduino class this is the first vid i have seen. After looking in to C# Object Oriented programming.. with the main goal of learning what OO is all about.. Thanks again sir.
@7Trident32 жыл бұрын
59 and trying to understand machine learning, progress is being made! Keep exercising that brain.
@samdeur2 жыл бұрын
@@7Trident3 That's awesome man.. i had a little break currently getting better from corona it's not to bad. Just a couple of weeks and then i'm going back taking C# by the horns and then to my destination C and C++.. Your so right exercising the brain is important. It's so funny that years ago people thought that at a certain age Neural plasticity declines. Science caught up and now we now the brain is like a muscle and training makes all the difference..
@davebeckham54295 жыл бұрын
Very useful Dave. Looking forward for similar tech note. - Many thanks.
@thebaconbreadful3 жыл бұрын
very basic and concise. Good tutorial to get a straight answer.
@asiw5 жыл бұрын
Thanks for a most useful and clear introduction to Classes.
@deangreenhough34795 жыл бұрын
Many thanks for reminding me of the basics and for the clear and concise tutorial. A pleasure to watch. 🏴🏴
@vikasverma86683 жыл бұрын
Very nice explanation sir
@ryanowens1004 жыл бұрын
may i ask why do you need to set up void Begin for the pinMode @2:16? i thought you can use pinMode without doing this? beginner here my apologies.
@G6EJD4 жыл бұрын
You can but this is a library that shows how you can set up a pin mode by a begin statement eg begin.sensor(22); could be replaced with pinmode(22,mode) in the main code. In a library it’s usual to have all required functions in the library itself.
@TheCrepinsek5 жыл бұрын
I suggest to make video 2, where in class Led you use private: byte GPO, use constructor to set GPO, then update methods (remove GPO argument) declare for example Led ledIndicator(pin number); (creating object ledIndicator from class Led) ....in code ledIndicator.on(); ... Create more led objects...
@G6EJD5 жыл бұрын
Matej Črepinšek, it’s just an example, yes further improvements could be made, it’s more about the principles than refinement.
@TheOO235 жыл бұрын
I totaly agree, some very important point are missing : having GPIO private, having just 1 method to set led status. Also you should warn coders that delay() is not suited for decoupling. Otherwise it is very clear, thx!
@courtneyvassell3712 Жыл бұрын
We can't see what your doing, can you zoom in on what your doing, thanks
@kuillemaul45216 ай бұрын
The snoring in the background is the best
@G6EJD6 ай бұрын
That was Bertie the Jack Russel terrier 😀💤
@santorcuato5 жыл бұрын
Thanks Dave, clear and useful. Keep going!
@mksmurff5 жыл бұрын
Thanks for this. Genuinely found this all easy to understand
@omkarkhade46024 жыл бұрын
Very nice tutorial It helped me a lot.
@SebastianScholle3 жыл бұрын
Thanks for your great videos David. I'd like to suggest an improvement on the 'class'. That we store the GPIO pin as a member of the class, then we don't need to pass in the PIN on each function. - this helps reduce repetition of the 'LED_BUILTIN' variable and simplifies the code.
@G6EJD3 жыл бұрын
Agreed thanks.
@alejandroperez53683 жыл бұрын
But then you would lose the ability to choose which LED you want to operate...wouldn't you?
@G6EJD3 жыл бұрын
Yes I hadn’t thought of that aspect
@MeinLieberTurnschuh2 жыл бұрын
@@alejandroperez5368 no. because either way you have to declare the pinmode for each gpio. So this class here is always only for one gpio. It might probably work because the pins are outputs on default. If you do it right you have to declare pinmode for every gpio. Just create an object for every LED
@dano47005 жыл бұрын
Cheers. I found that very clear.
@jedandecko55855 жыл бұрын
Thanks, very nice and short explanation.
@dilshankasthuriarachchi47373 жыл бұрын
sir then we use if sentence and all the other data types and variables for this?
@G6EJD3 жыл бұрын
I do t understand your question. If you declare any variables within an if statement then they only exist within the if statement extents
@dilshankasthuriarachchi47373 жыл бұрын
@@G6EJD yeah i want you to know that can ve use any data type when writing a class can we?
@louiskatzclay2 жыл бұрын
Thanks David! I have sort of understood this for a while and have a project in need of simplifying. It is hard to find good easy to understand material on this. 73 de w0it.
@SymphonicSync3 жыл бұрын
Thank you so much. It was very clear, straight forward and useful.
@yousefabdallah-e7g11 ай бұрын
super underated and very helpful
@mikesfarmmikesfarm39772 жыл бұрын
thx much for this vid. I think this will help me from now on.
@skrame01 Жыл бұрын
Cqn you make the text smaller please?
@BLie20003 жыл бұрын
good tutorial for the class and header file.
@Bahrami125 ай бұрын
Thanks a lot for this toturial❤
@JimK0QJC4 жыл бұрын
Very good example. I needed just that for a quick review. Please continue with your channel. W3IPO
@andrewkieran89425 жыл бұрын
Great content once again! I would welcome more programming techniques videos. For example, how would you write such a class, without using the 'delay' function which ties up the processor? I understand using millis but my programs without delays often become unwieldy. Perhaps you could explain how to use and manage state machines.
@michaelpadovani95665 жыл бұрын
Great topic and awesome video once again Dave!
@G6EJD5 жыл бұрын
Is this because you have a lot of I/O going on and the delays help to visualise what is happening? In which case I can see how a state machine would help.
@andrewkieran89425 жыл бұрын
@@G6EJD I'm using ESP8266 modules and I understand why people recommend avoiding blocking code ,to keep the wi-fi running smoothly. I like how clearly and succinctly you explain things so I would be grateful if you'd delve into more programing techniques. I think state machines is one topic I'd like to better understand.
@Thinks-First2 жыл бұрын
This is an excellent question. I'd like to know any and all techniques that allow the program to continue while allowing functions to be carried out at their own pace. Other than using outside hardware I have no idea how that is done.
@Thinks-First2 жыл бұрын
0:30 Didn't you mean to say that "LED" was the OBJECT, not the CLASS ? The class is "LED_Controls". Great video though. It really helps me understand how Classes are created and used. You're excellent. I'll be following your work. THANK YOU !
@kosa20045 жыл бұрын
A great tutorial again!! Learned a lot from you 🍻🍻🍻
@bertrandnadeau32544 жыл бұрын
Very clear explanation! I subscribe...
@alikeyhani90802 жыл бұрын
Thanks a lot man. It was wonderful!
@MaxGoddur5 жыл бұрын
What you just did is one of the few videos showing how to program using Arduino IDE. There is a need for more videos showing programming as you have done. I have searched for such videos using Arduino IDE and NodeMCU but have not found many. I currently am trying to incorporate Time into my sketch rather than using delays but NTP is rather large. Need to learn how to reference the time ino sketch I have copied and used as a stand-alone file referenced from my main ino sketch. Is this possible?
@G6EJD5 жыл бұрын
Yes, but it's a little tricky to format the time. Yes you could produce a .h file called 'my_time' or WHY and include that anytime. The trick is to put a small delay usually about 1-sec to allow time services to start, but you only need to do this one. Don't forget (libraries aside) any Arduino sketch will run on a Nodemcu. If you stuck for a time example I have one.
@MaxGoddur5 жыл бұрын
@@G6EJD How does one use time as in this example. String myTime=(timeClient.getFormattedTime()); if (myTime > 18:30) { Serial.println("It is alarm time"); } Not sure about all the in and outs for type data as in ; int, string etc.
@G6EJD5 жыл бұрын
@@MaxGoddur See this example: github.com/G6EJD/Examples/blob/master/ESP8266_Time_Services2.ino
@G6EJD5 жыл бұрын
Local time is a string so you need to do this if (localtime >”07:30”)
@MaxGoddur5 жыл бұрын
When I tried your example using local time I got the following error: NTPExample:42: error: stray '\342' in program if (localtime > �07:30�)
@MaxGoddur5 жыл бұрын
Will the code you show work if I upload to NodeMCU as written in your video?
@G6EJD5 жыл бұрын
Absolutely yes, I was merely using the UNO as a point of reference. In-fact I do all my testing on a NodeMCU.
@foodbygintea18225 жыл бұрын
Sir, thank you very much.. I'll pray for you
@jon_raymond5 жыл бұрын
Thank you for explaining this!
@GarretsonIndustries5 ай бұрын
Why has no one mentioned auto format before
@G6EJD5 ай бұрын
It’s a little used compiler function that in 99.99% of choice it will get correct!
@justembeditАй бұрын
thanks, that was really helpful
@BaronVonBiffo5 жыл бұрын
Succinct and very useful. Thank you.
@Johann752 жыл бұрын
Good & simple, but not the best example. The class looks more like just functions. I am also missing the private:, public: part explained...
@jameskuria16643 жыл бұрын
Big up Dave
@rachidaliosinachi20654 жыл бұрын
Honestly you’re excellent !
@Thinks-First2 жыл бұрын
Very good.
@mrphysh5 жыл бұрын
"GPIO_pin" seems to fall out of the sky. This is a reference to pin 13, I know. This tells us that it is a "pneumonic", or reserved word, or something like that. I find no references to it. Can you confirm this. If I am an idiot, just tell me. I am cool with stuff like that. (good video)
@G6EJD5 жыл бұрын
Gpio_pin is a local variable defined at void begin(byte GPIO_pin)
@mrphysh5 жыл бұрын
@@G6EJD The definition I was missing is in the 'setup'. LED_BUILTIN I will keep going around and around with this. thanks
@G6EJD5 жыл бұрын
mrphysh some boards have this definition done not the UNO does and most ESP types do, if it’s not there you can define it with #define LED_BUILTIN 13 Or whatever pin you like or are using
@ralphsymmons41114 жыл бұрын
Is that a dog snoring in the background? Many thanks for this concise guide.
@G6EJD4 жыл бұрын
Ralph Symmons, yes 😀 he insists on sleeping on my feet so I decided to carry on anyway, Bertie a 15-year old Jack Russell.
@surenbono60634 жыл бұрын
class Serial_Output { public: void B() { Serial.begin(9600); } void p(String n){ Serial.print(n); } void pl(String n){ Serial.println(n); } }; // Class Object Serial_Output S; void setup() { S.B(); } void loop() { S.p(" hello same line "); delay(1000); S.pl(" hello start next line"); delay(1000); } // With this class tuturial i simplified Serial.begin,print & println to S.B, S.p & S.pl...thnks
@MatSmithLondon3 жыл бұрын
Is there a dog snoring in the background? Can hear it clearly with headphones :) Or maybe a human?!
@G6EJD3 жыл бұрын
Yes indeed our 16-year old Jack Russell - Bertie, always sat at my feet😀
@MatSmithLondon3 жыл бұрын
@@G6EJD Awww. An old boy! We have a young cockerpoo, never sat still for more than 10 seconds, but still very loved! Thanks for the video... great introduction and very clear!