I have read, searched and studied for 2 weeks and am no closer to finding even the simplest descriptions/lists of functions so that I can write code. Every thing I read on help sites always say load the libraries, but all that does is give me examples of code. What I need is a list of the functions that a particular device needs to access it. Like what are the commands/functions, data formats that are needed to get/set the time from a RTC or to write to LCD panel. What am I missing? I have been programming very complex code in basic for years. What am I missing?
You can look at the source of libraries by looking at their .h and .cpp files
This will enable you to see which functions are available, the parameters passed to them and the value returned, if any. Of course, a properly written library will also have documentation, but this is often not provided or is inadequate.
The very best libraries will have a "readme" or help file which describes every function, what it does and what you have to do to make it do what it does.
But you don't need that at all. Everything is open-source. You just read the source file to see what functions are available. The .h file in any library contains all of the functions which your code can access. If you want to find out what each function actually does, read the .cpp file.
I have looked at the .h and .cpp files for the functions. It seems on the device I have, they seem to be woefully lacking in info that is helpful to someone new. The readme files for most of what I am looking at just say "This is the library" and not much more. And the examples are to complex for a beginner. By the way the device I have is a PLC from Digital Loggers company. It has RTC, LCD display with touchscreen along with an array of digital/analog ins and outs. I called them and they just said go to github and every thing is there!
You can generally assume the common C language functions, as used in K&R or a decent Unix reference manual (I use an old Bell Labs Unix System V Programmer Reference Manual) will get you close. Sadly, reading the source code is the only solid reference for many of the Ardunio specific functions, as the online documentation is free-form, example-centric, and vague on details like argument types, return codes, etc.
Google will get you unauthoritative answers in the form of various forum threads but the signal to noise ratio is poor. Prepare to do lots of small sketches to determine experimentally what things really do and what really happens. I find the whole ecosystem serviceable for small IoT projects but this isn't a production environment for professional development of large-scale software.
Thanks, I have the C++ for dummies book. but that is more confusing then helpful for me. I'll keep reading and try and figure it out. The very best manual on programming that I ever saw was the one that came with the Radio Shack TRS 80 computers. With that manual, you could teach a corpse to program.
What does the Arduino have to do with the PLC? If you have your heart set on using that PLC, then just program it directly.
Oh..I see. That's a pretty nifty device.
Also useful to have on hand is a copy of the AVR library user manual. I put a copy of the latest(?) on my Github page as it is too large to attach here.
The GCC documentation is good also.
Sorry off trying to understand the libraries for this thing. Yes, it is a nifty thing. I have programmed many of these types of controllers in basic. They all came with necessary info to program. I was hoping to use this PLC, as it is open source and I would not have to continuously buy the programming software for other commercial PLCs that they make you buy. Most commercial ones have a limited basic for a language and at times had to use up to 15 nested if/then statements do to no gosubs or goto statements allowed. No fun. I'll keep at it.
The Arduino platform is not as restrictive as others in terms of the programming language. That is why I chose the Arduino platform.
The Arduino uses standard (C) C++. If you are trying to program the Arduino, learn C then browse through the basics of C++ programming. The latter will help you understand the libraries and their instantiation and usage. The most obvious examples are dealing with the lcd displays and serial communication (ie., Serial.print() why is there a period in the function call? C++ will answer that)
For all intents and purposes I program the Arduino using ANSI C. I learned C from a book called "The Absolute Beginner's Guide to C". I used it junior year of high school and was all I needed to cover 14 of 16 weeks of the college engineering class in programming C (the last two weeks covered linked lists which was not in the book, and was only on the final exam in concept not practicality).
My suggestion is to find a read a copy of "The Absolute Beginner's Guide to C", then find a book or website on the basics of C++. A website with enough information to answer the above question. The will take care of the general side of programming. The remainder, the list of "Arduino specific" functions are included on this site under Resources->Reference->Language Reference and ->Libraries.
Did you look at Adafruit's web site for info? Is that where you bought it?
It's not totally clear if your problem is the C / C++ language itself or this particular library.
As noted, the only authoritative documentation for many libraries is (unfortunately) the source code itself. If you have a solid grasp of C plus a rudimentary understanding of Object Oriented Programming (classes and objects), then the .h files combined with the (hopefully commented) examples are enough to get you going many times. To dig further might require learning some of the more esoteric (for me) features of C++.
The quality and complexity of available library code varies greatly. One problem is that in order to support many different processor boards and other hardware, library authors use a maze of templates, macros, and indirection such that it's difficult (again for me) to trace the program flow completely.
Anyway, if you post a link to the exact device and the library you're using along with your coding attempts, forum members will try to assist with your questions.
I also try to follow the program flow and get lost in the weeds. The demo program for this device looks like it has endless subroutines on top of subroutines. The lack of documentation is like, "how to start a car"? You put a key in it and start it, but failing to realize that one might not know what a key is or looks like, and where to put said key, and just what is a car?
Post the links to hardware and library.
mkwillauer:
I also try to follow the program flow and get lost in the weeds. The demo program for this device looks like it has endless subroutines on top of subroutines. The lack of documentation is like, "how to start a car"? You put a key in it and start it, but failing to realize that one might not know what a key is or looks like, and where to put said key, and just what is a car?
The documentation for the arduino core librariy is on this site. Arduino Reference - Arduino Reference
The documentation for various standard add-ons is at Libraries - Arduino Reference
The documentation for the libc core is at avr-libc: Modules
The documentation for other bits of hardware is wherever the vendor of that hardware says it is.
As for your real question: where do you start, you start by running through the examples in the File>Examples menu in the IDE. Or perhaps better, visit the Tutorials page on this web site: https://www.arduino.cc/en/Tutorial/HomePage
I can program a simple arduino with a small lcd display. It is trying to understand how to get the PLC to understand a simple program. I am not able to find the functions to make it understand.
Isn't it just an arduino at heart? So that it does not necessarily have built in functions but examples and demos just like any arduino.
It's just in a rugged box, right?