Timeline for Classes and objects: how many and which file types do I actually need to use them?
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 8, 2017 at 20:07 | comment | added | Nick Gammon♦ | I don't know as I haven't used it. | |
| Nov 8, 2017 at 9:50 | comment | added | user31481 | What about UECIDE? Does it does the apply the same treatment? | |
| Jul 8, 2015 at 4:56 | comment | added | Soundararajan | This explaination is better than the arduino build process documentation :-). thanks | |
| Jul 7, 2015 at 17:37 | comment | added | user6569 | For example, nick has excellent suggestions on how to write Arduino code. I can't think of a single library I've seen that follows it. A library I am dependent on at the moment was written back before Arduino was Arduino (it was wiring) and has not been updated since. It took several days to figure out how to make it work like a standard C++ program would behave. | |
| Jul 7, 2015 at 17:33 | comment | added | user6569 | @heltonbiker sorry, I was just saying, some people (myself included) get very frustrated when we get free code and it doesn't work. I either have to fix it myself, or look elsewhere. Fortunately there is helpful people like Nick to explain things, but very often there is no, or an out of date explanation. 'what is available' may not always be the same as 'what works', so depending on your comfort, it might not meet your needs. | |
| Jul 7, 2015 at 12:38 | comment | added | heltonbiker | Thanks for the extra explanation! Now it's a lot clearer to me, and it's working fine with the .h and .cpp files like you explained! | |
| Jul 7, 2015 at 12:35 | vote | accept | heltonbiker | ||
| Jul 7, 2015 at 12:34 | comment | added | heltonbiker | @Spiked3 Is not so much a matter of choosing what I'm most comfortable with, for now, it is a matter of knowing what's available for me to choose from in the first place. How could I make a sensible choice if I don't even know what my options are, and why each option is the way it is? Like I said, I have no previous experience with C++, and it looks like C++ in Arduino might require extra care, as shown in this very answer. But I'm sure eventually I'm getting a grasp of it and get my stuff done without reinventing the wheel (at least I hope so) :) | |
| Jul 6, 2015 at 22:37 | comment | added | user6569 | They also will fail if you include a .H file in two of your .cpp files and that .h file contains code, which is a common habit of some. Its open source, just fix it yourself. If you are not comfortable doing that, you probably shouldn't be using open source. Beautiful explanation @Nick Gammon, better than anything I have seen so far. | |
| Jul 6, 2015 at 22:03 | history | edited | Nick Gammon♦ | CC BY-SA 3.0 | Fixed typo. |
| Jul 6, 2015 at 21:07 | comment | added | Nick Gammon♦ | How do you not do it? Just put them all together as illustrated in my answer, however you may find that the preprocessor works against you. Some perfectly valid C++ class definitions fail if they are put in the main .ino file. | |
| Jul 6, 2015 at 21:06 | comment | added | Nick Gammon♦ | Added another couple of paragraphs to answer why "probably" you should have separate files. | |
| Jul 6, 2015 at 21:06 | history | edited | Nick Gammon♦ | CC BY-SA 3.0 | Added an explanation about why "probably" you should keep separate .h and .cpp files |
| Jul 6, 2015 at 11:55 | comment | added | heltonbiker | Nice answer. One most important topic, though, didn't became clear to me yet: why everybody says "you are probably best off to follow normal practice: .h + .cpp"? Why is it better? Why the probably part? And most important: how can I don't do it, that is, have both interface and implementation (thas is, the whole class code) in the same, single .cpp file? Thank you very much for now! :o) | |
| Jul 6, 2015 at 5:19 | history | answered | Nick Gammon♦ | CC BY-SA 3.0 |