I have been following the tutorial about making the Morse library:-
I don't have a problem with understanding the code, but I'm using the Arduino IDE, & I'm struggling with the processing of those files. The IDE seems to require me to save my source files as .ino. I tried making the folder "Morse" in my "libraries" folder, and using Notepad to make the source files & save them as ../libraries/Morse/Morse.cpp & .h. I'm rather expecting some sort of language processor to convert these into some intermediate (object?) format file to be "linked?" with the main program, but I haven't grasped the mechanism of doing that, & that part doesn't seem to be covered in the tutorial - or I have overlooked it.
Using the Arduino IDE, can I make my own library object programmed in c++?
Can anyone point me at some tutorial or reference document that covers the language processing part of that, as opposed to explaining the c++ language.
You don't make library objects. The library source is part of the project compile.
Using the Arduino IDE, can I make my own library object programmed in c++?
I'm not sure in what sense you are using the word "object" here. Libraries are source files.
Make a folder. Put a .cpp file in it. Put a .h file in it. Put that folder into the "libraries" folder under your sketches folder. Restart the IDE so it notices. Done.
Thanks Rob. I guess I was surprised that, essentially, your library module contains c++ objects, but the IDE doesn't provide a supportive development environment for that.
Since posting, I have moved away from bothering with the library. I'm just putting my object definitions & implementations into the main file, so the whole of my program resides in a single .ino file. When I started, I wanted to capitalise on the encapsulation capability of objects; separating out the major functional aspects into distinct sections of the file. So I had already positioned my data, albeit global data, spread through the source file in order to put it with the parts of code that acted on it.
I then moved on to coding c++ objects in-line & lo, it worked! So I can program my arduino in c++ using the standard IDE. I had been somewhat misguided in thinking I could only write in something that looked fairly close to vanilla c, although I was aware that I could use objects, as evidenced by the Serial facility. It just seemed pretty odd that I could have an object from a library, but no program development capability for it in the IDE, & an IDE that seemed to be blocking me from editing .h or .cpp files.
Note to self. ... I must check out whether Arduino provides "new" & "delete". I'm guessing the answer is probably no. With just 2k bytes of RAM to play with, what chance of fitting a heap into that?