[SOLVED] Implementation of analogRead in a daq class calling MCP3208 library

Hi there everyone,

I’m new doing classes, so me and my classmates are a bit confused.
The project consists of doing the programming of a daq shield for Arduino(we have already done the hardware).
Our problem is the following, we have to implement several functions of a class (daq) - and for starters, we don’t know how to implement analogRead to read the 8 analog channelinputs of the MCP3208 DAC. I attach the files of the library so you can see better what’s wrong on what we’re doing.

As you can see, we are trying to call the mcp3208 library from the .cpp of the daq library, and we don’t know if that’s correct. Even if we have to write an begin() each time that we create an object.

The last question that we have is how is the right way to create a object:
MCP3208 myMCP3208= MCP3208(); or MCP3208 myMCP3208;

Moreover, is it possible to create an object within a library (we’ve create a MCP3208 object within the daq library).

I don’t know if I have conveyed clear all my doubts, but I think that if someone that knows a little of programming would see quickly what are our knowledge lacks.

Thank you all, I wish you could help us.
Our brain is gonna explode, we don’t find any information about this on the internet.

Thanks a bunch!!!

daq2.h (1.2 KB)

daq2.cpp (1.54 KB)

Modificacion_implementaciones_4.ino (583 Bytes)

If you were to replace the MCP3208 with a different IC which one would you use?

Your DAQ library has to be able to use either the MCP3208 or the other IC; otherwise, there is no point in having a DAQ library.

Oh yes, my daq shield contents MCP3208 (ADC) and MCP4902 (DAC), and also a voltage reference chip.

I solved it, I wasn't programmming the chip select... I also have modified the code, if anyone need it.

If you've solved it, please edit your post to add SOLVED to the subject matter.

In thhis link to Español Arduino forum you can find the code, http://forum.arduino.cc/index.php?topic=539340.new;topicseen#new