I am having a lot of trouble getting my head around the "accepted way" of doing things with variable names and all that sort of thing too.
I have a post about my RTC on the I2C bus.
As best I can, I am starting from scratch and building a simple "clock" which sets and reads the time over the serial port.
As I have a working clock, I tried to take parts of that and use them pieces to get a working sketch.
DIDN'T HAPPEN.
Putting that all aside, I sat down and read more of my "C++ for dummies" book. Yeah, maybe not THE book to read, but it should help.
Before going into what the book says, let's look at some of the things which are tripping me up.
Here are a few problems I have:
(Exerts from a WORKING sketch)
#include "DS1307_1.h"
#include "alarm_clock.h"
int rtc[7];
DS1307 RTC=DS1307(); // Create RTC object
Ok, so this is two "includes" of the DS1307_1.h and the alarm_clock.h
Why the _1 for the DS1307? There is no DS1307_1.cpp file.
But there is a DS1307.cpp file.
the next part sets up the variable rtc to have 7 "parts".
No problems.
Then DS1307 RTC=DS1307();
CONFUSING!
C++ for dummies chapter 12.
Page 166:
To create an actual savings account object, I type something like the following:
SavingsAccount mySavingsAccount;
We say that mySavingsAccount is an instance of the class SavingsAccount.
Then it goes on about the naming convention and ends up by saying the compiler really doesn't care about case (etc) of the names.
Now, ok, putting THAT aside, the name is shown as RTC - note the capitols.
Else where in the code there is this:
int rtc[7];
RTC.get(rtc,true);
rtc[7] and RTC.get(
Ok, I am setting up rtc[7]. But RTC.get(rtc.true)??
I'm guessing that RTC.get( ) is in......
Well I found it in alarm_clock.ino.
I'm taking it that RTC.get(rtc.true) the RTC is what was declared with the DS1307 RTC=DS1307(); and get(rtc.true) ....
Ok, sort of understood.
Then there are these:
byte alarm_clock::run()
That is when you are using another member function in another class - or something.
I am trying, but it isn't well explained for me.
What the book says SORT OF makes sense. But I can't compare it to what I am seeing with the Arduino and the codes because of small inconsistencies like the DS1307 RTC=DS1307(); example.
It doesn't explain what is going on there.
Please, someone.