|
|
hi,
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> ...
> Interesting. I can _rationalize_ why it would be that way, but I might have
> taken me days to happen upon the proper syntax.
> I'll give it a whirl and see where it gets me.
> Thank you very much, as always.
no sweat. :-)
> > in your case, the vector would be made of type foo;
>
> Vector.... ?
ignore. misremembered.
> > yes, I recently installed one of those C++ library-in-a-header files. not my
> > cup of tea.
>
> So "yes" means the cpp file gets automatically referenced...
no. "yes" meant </sigh>, I guess. afaik there's no .cpp; you include the
header and get the library functionality.
<https://github.com/g-truc/glm/releases>
> > as regards the first question, I should have thought that, for a small project,
> > you can have all sensor constants etc in a single header, just a matter of
> > avoiding name clashes.
>
> So in the .h file, I have in part:
> class TMP117
> {
> public:
> TMP117(); // Constructor
>
> bool begin(uint8_t sensorAddress = 0x48, TwoWire &wirePort = Wire); // Checks
this looks so wrong. if I read your intent correctly, in C, that would need to
be something like:
bool begin(uint8_t, TwoWire *);
and then, the values, either '#define'd or, better, in (const) variables, eg in
the header:
extern uint8_t const sensorAddress;
extern TwoWire * const wirePort;
and in your source, somewhere near top:
uint8_t const sensorAddress = 0x48;
TwoWire * const wirePort = Wire;
> ...
> I'm also guessing the simplest way to copy-paste code to deal with multiple
> sensors would be to make a new class for each sensor? ?
seems to me that if the sensors are of the same type, you'd only need so many
instances, if they differ, I guess some sensor parent class + per type classes
inheriting from that. (usual 'no speak c++' disclaimer)
can't really comment on the remaining question. I would have thoughr though
that there are enough arduino projects on the web to .. analyse and peruse.
regards, jr.
Post a reply to this message
|
|