Show Posts
Pages: 1 2 [3] 4 5 6
31  Using Arduino / Project Guidance / Accessing an arduino as a storage device on: February 01, 2011, 05:34:54 am
Hi,

I have an arduino Mega that’s successfully logging data to an SD card. To read the data on the card I need to unplug it from the arduino and put it into my laptop.

Not all laptops have SD drives, so it occurred to me that it might be useful if I could plug the arduino into the laptop USB port and have the arduino with SD card appear as a storage device so the data can be accessed in the same way as any other drive but without the need to unplug it from the arduino.

Does anyone know what this would involve doing, or even if it’s feasible (or even better, has it already been done)?

Mike
32  Using Arduino / Programming Questions / Re: Hardcoded strings and PSTR on: January 29, 2011, 03:20:47 am
The problem isn't with the _P equivalents, it with the interpretation of hardcoded string literals. This command....
Serial.println(PSTR(“Hello world”))
Ought to work but doesn't (not in arduino world anyway). This forum hosts threads about this, but the most recent one I could find was over a year old and I was hoping for some fresh developments since then.

I'll try the flash library.
33  Using Arduino / Programming Questions / Re: Free memory questions on: January 28, 2011, 10:16:53 am
Thanks Paul,

This is radically changing my perception of how memory is handled in an arduino. I though that memory was dynamically allocated and de-allocated as objects move in and out of scope.
I guess this means that if I build a large project full of librarys and classes then ALL memory gets allocated up front no-matter no matter now deeply burried a particular object is?
Also, I guess this means that if I include some obscure little function that only ever gets called once it will still be using up it's memory allocation for the entire duration the sketch is running, rather than the brief nanoseconds when it's actually being used?
Finally, assuming I never use malloc() and free() does that mean that the amount of free memory available will remain constant at all points in the sketch?

Kind Regards

Mike
34  Using Arduino / Programming Questions / Re: PROGMEM and strcpy_P on: January 28, 2011, 10:00:29 am
Thanks for the solution Paul
Quote
I moved the ERR_300 and ERR_301 variables to global scope

That seems to have cured it. Any idea why?

The code snipet I posted is part of a larger function for handling any one of about 25 errors, I've noticed some threads for doing similar stuff involving using tables, but I'm not really sure if this would offer any advantage. Any suggestions on the best approach for this?

Regards
35  Using Arduino / Programming Questions / PROGMEM and strcpy_P on: January 28, 2011, 08:06:26 am
Hi,

I’m having trouble with PROGMEM and strcpy_P. ( It seems I’m not the only), I’ve checked the forum, and from what I can tell this code ought to work. It compiles ok, but churns out garbage when it attempts to print out the data I’ve copied from EEPROM into ‘normal’ memory.

What am I doing wrong?


Code:


#include <avr/pgmspace.h>  // Needed for PROGMEM stuff

void setup()
{
  Serial.begin(115200);//Communication speed for the display
  Serial.println("######################################################");
  Serial.println("Starting......");
  Serial.println("######################################################");
}

void loop()
{
  for (int x=300; x<302 ;x++)
  {
    dispCmsErrorMess(x);
    delay(100);
  }
}


// Given a +CMS error, find the appropriate error message (data taken from http://www.dreamfabric.com/sms/cms_error.html)
// returns 'true' only if a match for the error number is found
bool dispCmsErrorMess(int err_num)
{
  char errMessage[35];        // Array to hold the error message
  errMessage[0]=0;

  // Note 'PSTR' forces the enclosed string to be stored in program memory (PROGMEM)
  // rather than data memory

  prog_char ERR_300[] PROGMEM = "Phone failure";
  prog_char ERR_301[] PROGMEM = "SMS service of phone reserved";

  switch (err_num)
  {
    case 300:
      strcpy_P(errMessage,ERR_300);
      break;
    case 301:
      strcpy_P(errMessage,ERR_301);
      break;
  }
 
  // force a null terminator to stop the print spiraling out of control
  errMessage[35]=0;

  Serial.print("Err#=<");Serial.print(err_num);Serial.print("> Err mess=<");Serial.print(errMessage);Serial.println(">");
}
36  Using Arduino / Programming Questions / Hardcoded strings and PSTR on: January 28, 2011, 04:27:19 am
Is there a simple solution to the PSTR issue?

I recently got all excited when I discovered I could use.....
#include <avr/pgmspace.h> and PSTR()
To write all my hardcoded strings to program memory rather than data memory. I duly changed lots of hardcoded stuff

Serial.println(“Hello world”) became  Serial.println(PSTR(“Hello world”))
And
strcpy(errMessage,("not plugged in")) became strcpy(errMessage,(PSTR("not plugged in")))

Throughout my code, only to discover it didn’t work and I had to undo everything!

I checked the forum, and it’s obviously a known issue (wish I’d checked before I’d made the changes). Is there a fix to this issue, or maybe a better way of doing this? I did discover a couple of posts about this, but they seemed to only work for Serial.println, and not for all inline strings.
37  Using Arduino / Programming Questions / Re: Free memory questions on: January 28, 2011, 03:41:21 am
Thanks, I now know more than I did, but I’m still puzzled by what I’m seeing. I’ve modified my test sketch, and again the results aren’t what I expected.

Firstly, I’ve put each of my tests in it’s own function, I would expect to see the memory available change from as each of the string arrays go in and out of scope?
Secondly, When I call ‘free()’ I expect to see the amount of free space increase by the number of bytes  in the array. Why isn’t this happening?
Thirdly, if I change the sketch and declare a couple more 100 byte arrays then I would expect free space to drop. It doesn’t. Why not?

Here’s the sketch.
Code:
#include <MemoryFree.h>                // Memory library - used to check how much free space is available

char string1[100+1];
char string2[100+1];

void setup()
{
  Serial.begin(115200);//Communication speed for the display
  Serial.println("######################################################");
  Serial.println("Starting......");
  Serial.println("######################################################");

  string1[0]=0;
  string2[0]=0;


  Serial.print("Before calling test 1. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
  test1();
  Serial.print("After calling test 1. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");

  Serial.print("Before calling test 2. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
  test2();
  Serial.print("After calling test 2. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");

  Serial.print("freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
}

void loop()
{
  for (int x=0; x<30000 ;x++)
  {
    Serial.print(".");
    delay(3000);
  }
}

void test1()
{
  Serial.println("######################################################");
  Serial.println("Test 1......");
  Serial.println("######################################################");
 
  Serial.print("Step 0. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
  char stringA[100+1];
  stringA[0]=0;
  for (int z=0;z<9;z++)
  {
    Serial.print("z=<");Serial.print(z);Serial.print(">, sizeof=<");Serial.print(sizeof(stringA));Serial.print(">, strlen=<");Serial.print(strlen(stringA));Serial.print(">. freeMem=<");Serial.print( freeMem() );Serial.print(">, freeRam=<");Serial.print( freeRam() );Serial.println(">");
    strcat(stringA,"1234567890");
  }
 
  Serial.print("About to free 100 bytes. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
  free(stringA);
  Serial.print("finished freeing 100 bytes. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
}

void test2()
{
  Serial.println("######################################################");
  Serial.println("Test 2......");
  Serial.println("######################################################");
 
  Serial.print("Step 0. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
  char stringB[50+1];
  stringB[0]=0;
  for (int z=0;z<4;z++)
  {
    Serial.print("z=<");Serial.print(z);Serial.print(">, sizeof=<");Serial.print(sizeof(stringB));Serial.print(">, strlen=<");Serial.print(strlen(stringB));Serial.print(">. freeMem=<");Serial.print( freeMem() );Serial.print(">, freeRam=<");Serial.print( freeRam() );Serial.println(">");
    strcat(stringB,"1234567890");
  }
 
  Serial.print("About to free 50 bytes. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
  free(stringB);
  Serial.print("finished freeing 50 bytes. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
}

And here’s the results
Quote
#################################
Starting......
######################################################
Before calling test 1. freeMem=<6832> (bytes), freeRam=<6794>
######################################################
Test 1......
######################################################
Step 0. freeMem=<-74> (bytes), freeRam=<8191> (bytes)
z=<0>, sizeof=<101>, strlen=<0>. freeMem=<-8267>, freeRam=<8191>
z=<1>, sizeof=<101>, strlen=<10>. freeMem=<-8267>, freeRam=<8191>
z=<2>, sizeof=<101>, strlen=<20>. freeMem=<-8267>, freeRam=<8191>
z=<3>, sizeof=<101>, strlen=<30>. freeMem=<-8267>, freeRam=<8191>
z=<4>, sizeof=<101>, strlen=<40>. freeMem=<-8267>, freeRam=<8191>
z=<5>, sizeof=<101>, strlen=<50>. freeMem=<-8267>, freeRam=<8191>
z=<6>, sizeof=<101>, strlen=<60>. freeMem=<-8267>, freeRam=<8191>
z=<7>, sizeof=<101>, strlen=<70>. freeMem=<-8267>, freeRam=<8191>
z=<8>, sizeof=<101>, strlen=<79>. freeMem=<-8267>, freeRam=<8191>
About to free 100 bytes. freeMem=<-8267> (bytes), freeRam=<8191>
finished freeing 100 bytes. freeMem=<-8267> (bytes), freeRam=<8191>
After calling test 1. freeMem=<-8157> (bytes), freeRam=<8191>
Before calling test 2. freeMem=<-8157> (bytes), freeRam=<8191>
######################################################
Test 2......
######################################################
Step 0. freeMem=<-8217> (bytes), freeRam=<8191> (bytes)
z=<0>, sizeof=<51>, strlen=<0>. freeMem=<-8217>, freeRam=<8191>
z=<1>, sizeof=<51>, strlen=<10>. freeMem=<-8217>, freeRam=<8191>
z=<2>, sizeof=<51>, strlen=<20>. freeMem=<-8217>, freeRam=<8191>
z=<3>, sizeof=<51>, strlen=<30>. freeMem=<-8217>, freeRam=<8191>
About to free 50 bytes. freeMem=<-8267> (bytes), freeRam=<8191>
finished freeing 50 bytes. freeMem=<-8267> (bytes), freeRam=<8191>
After calling test 2. freeMem=<-8157> (bytes), freeRam=<8191>


I think the memory functions I’m using should be ok, they’re referenced in several places on this forum (actually, that’s no guarantee!). So either my sketch or my understanding must be faulty.

I’ve just noticed that the only time the two memory functions return plausible results (and the only time they almost agree) is the first time they’re called. Is this significant?

All help appreciated.

Mike
38  Using Arduino / Programming Questions / Re: Free memory questions on: January 27, 2011, 05:27:24 pm
Ok, a couple of good points there, so what you’re saying is that if I declare an array of size [100] then 100 bytes will be allocated to it (and hence un-available to anything else) even if only a few characters of the string are used?

I assume that memory is only allocated when that particular array/object is within scope? So in my example since all of the string are within scope all of the time the amount of free memory remains the same?

Finally, Any idea why the two functions give such different values?

thanks
39  Using Arduino / Programming Questions / Free memory questions on: January 27, 2011, 02:30:55 pm
Hi,

I'm trying to save memory (RAM or data memory, not program memory) on a Mega2560, and I'm testing out some code I've found on this forum for displaying how much free memory is available. Firstly, here's the code I'm using....
.h file...
Code:
// memoryFree header
#ifndef MEMORY_FREE_H
#define MEMORY_FREE_H

#include "WProgram.h"     // needed for 'Serial'


#ifdef __cplusplus
extern "C" {
#endif

int freeMem();
int freeRam();
//void checkMem();

#ifdef  __cplusplus
}
#endif

#endif

.cpp file.....

Code:
#include "WProgram.h" 
#include "MemoryFree.h"

extern unsigned int __data_start;
extern unsigned int __data_end;
extern unsigned int __bss_start;
extern unsigned int __bss_end;
extern unsigned int __heap_start;
extern void *__brkval;


int freeMem()
{
  int free_memory;

  if((int)__brkval == 0)
     free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}


int freeRam()
{
  //int size = 1024; // Use 1034 with ATmega328
  //int size = 2048;  // Use 2048 with ATmega328 (Duemilanove)
  int size = 8192;  // Use 8192 with a Mega2560
  byte *buf;

  while ((buf = (byte *) malloc(--size)) == NULL);

  free(buf);

  return size;
}
 

Just to try to get some understanding of what's going on I've written some simple tests...
Code:
  Serial.print("Step 0. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
  char stringA[100+1];
  stringA[0]=0;
  for (int z=0;z<10;z++)
  {
    Serial.print("z=<");Serial.print(z);Serial.print(">, strlen()=<");Serial.print(strlen(stringA));Serial.print(">. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
    strcat(stringA,"1234567890");
  }
 
  Serial.print("Step 1. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
  char stringB[100+1];
  stringB[0]=0;
  for (int z=0;z<10;z++)
  {
    Serial.print("z=<");Serial.print(z);Serial.print(">, strlen()=<");Serial.print(strlen(stringB));Serial.print(">. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
    strcat(stringB,"1234567890");
  }

  Serial.print("Step 2. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println("> (bytes)");
  char stringC[100+1];
  stringC[0]=0;
  for (int z=0;z<10;z++)
  {
    Serial.print("z=<");Serial.print(z);Serial.print(">, strlen()=<");Serial.print(strlen(stringC));Serial.print(">. freeMem=<");Serial.print( freeMem() );Serial.print("> (bytes), freeRam=<");Serial.print( freeRam() );Serial.println(">");
    strcat(stringC,"1234567890");
  }
Now, here’s the issue. I’m expecting that each time I add a new string and then start increasing the length the amount of available memory will go down? But it doesn’t , here’s the results…

Quote
######################################################
Test 1......
######################################################
Step 0. freeMem=<5322> (bytes), freeRam=<5284> (bytes)
z=<0>, strlen()=<0>. freeMem=<36> (bytes), freeRam=<5284>
z=<1>, strlen()=<10>. freeMem=<36> (bytes), freeRam=<5284>
z=<2>, strlen()=<20>. freeMem=<36> (bytes), freeRam=<5284>
z=<3>, strlen()=<30>. freeMem=<36> (bytes), freeRam=<5284>
z=<4>, strlen()=<40>. freeMem=<36> (bytes), freeRam=<5284>
z=<5>, strlen()=<50>. freeMem=<36> (bytes), freeRam=<5284>
z=<6>, strlen()=<60>. freeMem=<36> (bytes), freeRam=<5284>
z=<7>, strlen()=<70>. freeMem=<36> (bytes), freeRam=<5284>
z=<8>, strlen()=<80>. freeMem=<36> (bytes), freeRam=<5284>
z=<9>, strlen()=<90>. freeMem=<36> (bytes), freeRam=<5284>
Step 1. freeMem=<36> (bytes), freeRam=<5284> (bytes)
z=<0>, strlen()=<0>. freeMem=<36> (bytes), freeRam=<5284>
z=<1>, strlen()=<10>. freeMem=<36> (bytes), freeRam=<5284>
z=<2>, strlen()=<20>. freeMem=<36> (bytes), freeRam=<5284>
z=<3>, strlen()=<30>. freeMem=<36> (bytes), freeRam=<5284>
z=<4>, strlen()=<40>. freeMem=<36> (bytes), freeRam=<5284>
z=<5>, strlen()=<50>. freeMem=<36> (bytes), freeRam=<5284>
z=<6>, strlen()=<60>. freeMem=<36> (bytes), freeRam=<5284>
z=<7>, strlen()=<70>. freeMem=<36> (bytes), freeRam=<5284>
z=<8>, strlen()=<80>. freeMem=<36> (bytes), freeRam=<5284>
z=<9>, strlen()=<90>. freeMem=<36> (bytes), freeRam=<5284>
Step 2. freeMem=<36> (bytes), freeRam=<5284> (bytes)
z=<0>, strlen()=<0>. freeMem=<36> (bytes), freeRam=<5284>
z=<1>, strlen()=<10>. freeMem=<36> (bytes), freeRam=<5284>
z=<2>, strlen()=<20>. freeMem=<36> (bytes), freeRam=<5284>
z=<3>, strlen()=<30>. freeMem=<36> (bytes), freeRam=<5284>
z=<4>, strlen()=<40>. freeMem=<36> (bytes), freeRam=<5284>
z=<5>, strlen()=<50>. freeMem=<36> (bytes), freeRam=<5284>
z=<6>, strlen()=<60>. freeMem=<36> (bytes), freeRam=<5284>
z=<7>, strlen()=<70>. freeMem=<36> (bytes), freeRam=<5284>
z=<8>, strlen()=<80>. freeMem=<36> (bytes), freeRam=<5284>
z=<9>, strlen()=<90>. freeMem=<36> (bytes), freeRam=<5284>
freeMem=<36> (bytes), freeRam=<5284> (bytes)

There are a number of issues with this.
Firstly, both functions are displaying totally different values
Secondly, both functions are displaying more-or-less unchanging values.

I guess either there’s something wrong with my code (very possible) or there’s something wrong in my understand of what I should be seeing.

Any suggestions?

Thanks

Mike
40  Forum 2005-2010 (read only) / Troubleshooting / Re: Trouble installing drivers on: June 07, 2010, 02:17:17 pm
Thanks. I've spotted a physical problem with one of the connectors in the USB socket on the board. I'll request a replacement
41  Forum 2005-2010 (read only) / Troubleshooting / Trouble installing drivers on: June 07, 2010, 04:41:30 am
I'm new to Arduino so I'm starting from the beginning. I've got a new Arduino Duemilanove straight out of the package and plugged it into my laptop. The power light goes on, and the orange led labelled “L” continuously flashes. So far so good. My laptop flashes up the messages 'New hardware found' followed by 'There were problems installing your new hardware, it may not work correctly' and “One of the USB devices attached to this computer has malfunctioned and windows does not recognise it” I assume this is because there's no driver available? The only recommendation from windows is to reconnect or replace the device – not very helpful!

I've downloaded and installed the Arduino 0018 design environment as per the 'getting started' instructions. I've tried to install the Arduino drivers by the following route.... control panel / add hardware / next.... the laptop pauses as it searches for new hardware, doesn't find any, then it asks me if the hardware is connected, I click 'yes' and then choose 'add a new hardware device' followed by 'install the hardware that I manually select from list' I then get a list of manufacturers that doesn't include anything I recognise, so I choose 'have disk' and browse to the location show in the 'getting started' guide. There are two files I can choose ftdibus.inf and ftdiport.inf. whichever one I choose I get presented with a blank list of hardware for which my options are 'have disk', 'cancel' or 'back'. The 'next' option is greyed out because I can't select any hardware from the blank list!

I've tried plugging it into different ports, I've downloaded the newest drivers as suggested by some of the other posts on this forum and I've checked control panel / system / hardware / device manager / ports and there's no sign of the 'Usb serial port' which I was hoping to see. I've also tried a different usb lead

I'm running Windows XP service pack 3 on a HP 6910p laptop. The Arduino was purchased from a normally reliable supplier (RS)
42  Forum 2005-2010 (read only) / Syntax & Programs / Re: Implementing a singleton class. on: January 19, 2011, 05:37:48 pm
Quote
an Arduino (normally) has only one thread
Does this mean an Arduino can be multithreaded? if so how? I thought arduino was single threaded only?

With respect to the original question, firstly, when a class is intrinsically linked to a single physical device it makes sense to have only a single instance of that class. Secondly, I have created multiple instances of my logger object, and although it does compile and run without error, only the first instance created actually manages to write to the file. This code snippet illustrates the problem….
Code:
#include <Logger.h>

Logger My1stLogFile;
Logger My2ndLogFile;

void setup()
{
  Serial.begin(9600);
  Serial.println("\n\rStarting......");
  
  My1stLogFile.writeLine("Line one");
  My2ndLogFile.writeLine("Line AAA");
  My1stLogFile.writeLine("Line two");
  My2ndLogFile.writeLine("Line BBB");
  My1stLogFile.writeLine("Line three");
  My2ndLogFile.writeLine("Line CCC");
  My1stLogFile.writeLine("Line four");
  My2ndLogFile.writeLine("Line DDD");
  My1stLogFile.close();
  
}
This runs without error but the resulting log file contains the lines written by the first instance of the object, not the second i.e......
Line one
Line two
Line three
Line four

If I reverse the order of the declarations then the file gets the other set of lines instead.

Basically I have 2 questions....
1) is it possible to implement a singleton class?
2) if the answer is 'yes' how do I do it?

Cheers
43  Forum 2005-2010 (read only) / Syntax & Programs / Implementing a singleton class. on: January 19, 2011, 04:32:40 pm
I'm trying to find out how to implement a singleton class. Here's the background...... I've been playing around with reading and writing to files on an SD card. I've written a very basic 'logger' class to write error messages and other stuff to a log file. So far so good, I can include the class in another class or a sketch and I can log messages to the file without problems.

I now want to include the 'logger' object in all of the classes in my arduino application, but I want all of my classes to write to the same log file on the SD card. My research so far tells me I need to implement this as a 'singleton class' so there will only ever be one copy of my 'logger' object.

At the moment my header file looks like this.....
Code:
#ifndef Logger_h    
#define Logger_h    

extern "C" {
  #include <string.h>
}

#include <stdlib.h>      
#include "WProgram.h"    
#include "Logger.h" // this file
#include <MikeSDFat.h>
#include <Sd2Card.h>
#include <FatStructs.h>
#include <Sd2PinMap.h>
#include <SdFat.h>
#include <SdFatmainpage.h>
#include <SdFatUtil.h>
#include <SdInfo.h>


class Logger
{
  public:
    Logger();                        // Constructor
    void writeLine(char * line);     // Write a line of data to the log file
    void close();                    // Close the file
  private:
    // Member variables
    MySDFat logFile;                  // needed to allow access to the logger file.
    int state;                           // used to determin the state of the file (open, closed etc)
    int lineCount;

};
How do I convert it to a singleton?

Regards

Mike
44  Forum 2005-2010 (read only) / Syntax & Programs / Re: Class constructors with parameters on: January 09, 2011, 05:27:15 pm
Thanks for the explanation Paul.

Cheers

45  Forum 2005-2010 (read only) / Syntax & Programs / Class constructors with parameters on: January 09, 2011, 04:56:58 pm
Hi,

I'm having trouble creating an object based on a class I've written. The problem seems to be because the constructor for the class takes a parameter.

First some background. I've written a total of three classes, all of which I've tested and used in sketches without problems.  The problem comes when I attempt to declare objects based on these classes as private member variables in the header file of another class I'm writing.

Two of the classes have a basic default constructor with no parameters. The third class has a constructor that requires a parameter to be passed to it. The two classes that require no parameters can be declared without problems. The third class (the one that requires a parameter) causes a list of compiler errors. There doesn't actually seem to be a problem with the class itself, I can use it elsewhere, I just can't declare it as a private member in another class.

Here's my declaration(s).....
  private:
    // Member variables
    GSM smsEngine;                       // needed to process incoming and outgoing SMSs
    Misc miscFuncs;                      // needed for the 'split' and 'trim' functions.
    MySDFat configFile("tracker.txt");   // needed to allow access to the configuration file.

And here's the error...

In file included from C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp:7:
C:\all_apps\arduino-0021\libraries\SMSinterface\/SMSinterface.h:30: error: expected identifier before string constant
C:\all_apps\arduino-0021\libraries\SMSinterface\/SMSinterface.h:30: error: expected ',' or '...' before string constant
C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp: In member function 'int SMSinterface::validatePhoneNum(char*)':
C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp:174: error: '((SMSinterface*)this)->SMSinterface::configFile' does not have class type
C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp:184: error: '((SMSinterface*)this)->SMSinterface::configFile' does not have class type
C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp:210: error: '((SMSinterface*)this)->SMSinterface::configFile' does not have class type
C:\all_apps\arduino-0021\libraries\SMSinterface\SMSinterface.cpp:234: error: '((SMSinterface*)this)->SMSinterface::configFile' does not have class type

What am I doing wrong?

Cheers
Pages: 1 2 [3] 4 5 6