Show Posts
Pages: [1] 2 3 ... 27
1  Using Arduino / Programming Questions / Re: How can I control the char of a return value when there is spaces on: Today at 02:21:31 pm
Dear Mitchinyon
if you spoke about this:
Code:
Serial.println("Call Ready\n");
it's not my woories.

my SendAtCmdWait() send a command and wait for an answer.
For exemple, this
Code:
if(sendATcommand("AT","Call Ready",2000)){
Serial.println("Call Ready\n");
};
the function send the AT commande and wait for "Call Ready" answer for two second.
If the good value is return, the function return true, or false. Then print Call Ready with \n and ln. But this not my worrie.

my woorie is in my function. The call ready is well return, but has the variable
'response' is compare with the variable  'expected_answer' (Call Ready__ and Call Ready), the function will always return false it's the reason why, I am wondering how I can avoid this issue. I am not an expet :o)


I uncomment this
Code:
Serial.println(response[x]);
to read the return. It's a char un it return first
C, then a then l in taht way, but it has two space (some time one)
C
a
l
l

R
e
a
d
y
space
space

     
2  Using Arduino / Programming Questions / Re: How can I control the char of a return value when there is spaces on: Today at 06:29:24 am
Dear Paul,
Are you excpecting of this?
Code:
int8_t Morse::sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout)
{

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialice the string
   
    delay(100);

    while( _cell.available() > 0) _cell.read();    // Clean the input buffer
 
    if (ATcommand[0] != '\0')
    {
        _cell.println(ATcommand);    // Send the AT command
    }

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(_cell.available() != 0)
            {    // if there are data in the UART input buffer, reads it and checks for the asnwer
                response[x] = _cell.read();
                Serial.println(response[x]);
                x++;
               if (strstr(response, expected_answer) != NULL)    // check if the desired answer (OK) is in the response of the module
            {
                answer = 1;
            }
        }
    }while((answer == 0) && ((millis() - previous) < timeout));    // Waits for the asnwer with time out
   
   
#ifdef DEBUG_SENDATCOMMAND
    if(answer)
    {
    Serial.println(F("RECEIVED!\n"));
    }
    else
    {
    Serial.println(F("NOT RECEIVED!\n "));
    };
    #endif
   
    return answer;
}
(I do not that code in Arduino software but TextWrangler soft)
3  Using Arduino / Programming Questions / How can I control the char of a return value when there is spaces on: Today at 06:08:07 am
Hello,

I am still using a function that works fine now.
Here is the function (look at: Serial.println(response
  • ))
Code:
int8_t Morse::sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialice the string
   
    delay(100);

    while( _cell.available() > 0) _cell.read();    // Clean the input buffer
 
    if (ATcommand[0] != '\0')
    {

        #ifdef DEBUG_SENDATCOMMAND
        Serial.print(F("Command sent : "));
        Serial.println(ATcommand);
        Serial.print(F("Expected for "));
    Serial.println(expected_answer);
        #endif
       
        _cell.println(ATcommand);    // Send the AT command
    }

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(_cell.available() != 0){    // if there are data in the UART input buffer, reads it and checks for the asnwer
            response[x] = _cell.read();
 
            Serial.println(response[x]);
            x++;
            if (strstr(response, expected_answer) != NULL)    // check if the desired answer (OK) is in the response of the module
            {

                answer = 1;
            }
        }else{
       
         
        }
    }while((answer == 0) && ((millis() - previous) < timeout));    // Waits for the asnwer with time out
   
   
#ifdef DEBUG_SENDATCOMMAND
    if(answer){
    Serial.println(F("RECEIVED!\n"));
    }else{
    Serial.println(F("NOT RECEIVED!\n "));
    };
    #endif
   
    return answer;
}

When I do
Code:
if(sendATcommand("AT","Call Ready ",2000)){
Serial.println("Call Ready\n");
};
The terminal display this, with two space
Quote
C
a
l
l

R
e
a
s
y
[vide]
[vide]
then it always return false.

How can I optimize my code? I would like, arduino ignoe the space(s) after the desired return value, there is space(s)?

Any help?
Thank
4  International / Français / Comment controller la réponse d'une commande on: August 26, 2014, 03:39:00 pm
Bonjour à tous,

J'ai une fonction qui va envoyer une commande et ca marche bien, sauf que....

Voici la commande (regarder surtout  Serial.println(response
  • )smiley-wink
Code:
int8_t Morse::sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialice the string
   
    delay(100);

    while( _cell.available() > 0) _cell.read();    // Clean the input buffer
 
    if (ATcommand[0] != '\0')
    {

        _cell.println(ATcommand);    // Send the AT command
    }

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(_cell.available() != 0){    // if there are data in the UART input buffer, reads it and checks for the asnwer
            response[x] = _cell.read();
 
            Serial.println(response[x]);
            x++;
            if (strstr(response, expected_answer) != NULL)    // check if the desired answer (OK) is in the response of the module
            {

                answer = 1;
            }
        }else{
       
         
        }
    }while((answer == 0) && ((millis() - previous) < timeout));    // Waits for the asnwer with time out
   

   
    return answer;
}
quand je fais ceci, il m'affiche "GPS Ready"
Code:
if(sendATcommand("AT","GPS Ready",2000)){
Serial.println("GPS Ready\n");
};
Par contre quand je fais
Code:
if(sendATcommand("AT","Call Ready",2000)){
Serial.println("Call Ready\n");
};
Il me retourne rien.

En fait , ceci Serial.println(response
  • ); affiche
Quote
C
a
l
l

R
e
a
s
y
[vide]
[vide]
avec deux vide.

C'est pourca qu'il n'affiche rien.

Je ne comprends pas car la fonction SendAtComdWait à cette fonction
Code:
strstr(response, expected_answer)
Donc normalement, dès que ca coincide, il doit retourner true???

Bon, ben non!!!

Alors comment je peux faire pour qu'il ne considère pas les espace après la chaine de caractere demandée, (s'il y a des expaces)?
Comme pourrais-je optimiser ceci?

Milles mercis
5  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 26, 2014, 12:37:14 pm
Hello.
Your test code work fine and it return reading text between the >> <<.

I also tryed to have the same result using a library and it works

SoftwareSerialTest.ino
Code:
#include <Morse.h>
#include <SoftwareSerial.h>

Morse morse(4800);

int pinToPowerOnModule = 8;
int dtr = 7;
int baud_rate = 4800;
int rxpin = 2;
int txpin = 3;


void setup()
{
  Serial.begin(9600);
  Serial.println("Test started");

  pinMode(pinToPowerOnModule, OUTPUT);
  digitalWrite(pinToPowerOnModule, LOW); // should default to this, but just being careful
  pinMode(dtr, OUTPUT);
  digitalWrite(dtr, LOW);

  digitalWrite(pinToPowerOnModule, HIGH);
  delay(3000);
  digitalWrite(pinToPowerOnModule, LOW);

   morse.begin();
}

void loop()
{
  morse.testSerial();
}
Morse.h
Code:
#ifndef Morse_h
#define Morse_h

#include "SoftwareSerial.h"
//#include "WProgram.h"

#define RXPIN 2
#define TXPIN 3

class Morse
{
  public:
    Morse(int pin);
    SoftwareSerial _cell;
    void begin(void);
    int baute_rate;
    void testSerial(void);
   
  private:
    int _baute_rate;
};

#endif
Morse.cpp
Code:
//#include "WProgram.h"
#include "Arduino.h"
#include "Morse.h"

Morse::Morse(int baute_rate):_cell(RXPIN,TXPIN)
{

  _baute_rate = baute_rate;
}

void Morse::begin(void){
_cell.begin(_baute_rate);
_cell.println("AT");
  Serial.println("Command sent");
}

void Morse::testSerial(void){
if (_cell.available())
  {
    Serial.print("Character received: >>");
    Serial.write(_cell.read());
    Serial.println("<<");
  }else{
  //Serial.println("none");
  }
}



This is the result
Quote
noneTest started
Command sent
Character received: >>A<<
Character received: >>T<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>O<<
Character received: >>K<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>C<<
Character received: >>a<<
Character received: >>l<<
Character received: >>l<<
Character received: >> <<
Character received: >>R<<
Character received: >>e<<
Character received: >>a<<
Character received: >>d<<
Character received: >>y<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>
<<
Character received: >>G<<
Character received: >>P<<
Character received: >>S<<
Character received: >> <<
Character received: >>R<<
Character received: >>e<<
Character received: >>a<<
Character received: >>d<<
Character received: >>y<<
Character received: >>
<<
Character received: >>
<<

Would you have a comment?

I was used to use a function the read the return display but it's mess.
Would you have recommandation to return true when we got "GPS ready", for exple?

May be I will open a new post and search for a solution

Many thank for your help
Cheers
6  International / Français / Re: Mon Mac crash quand j'utilise Arduino on: August 22, 2014, 03:42:13 pm
Je viens de réaliser que je dois retirer mon Arduino Mini pro 3.3V de mon circuit
pour ne pas avoir ce message
Quote
Binary sketch size: 13,474 bytes (of a 30,720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
Mais je n'avais pas ce problème avec la macbook pro  smiley-confuse
7  International / Français / Re: Comment puis-je récupérer des string séparé par des espaces on: August 22, 2014, 01:35:30 pm
D'accord mais alors pourquoi ca, ca ne marche pas

Code:
sscanf(inSerial,"%s%s%*[ ]%[^\n]",command,pos_char,sms_text);
 
      Serial.println(command);
      Serial.println(pos_char);
      Serial.println(sms_text);

Si je tape

sms 2 coucou

Le serial print devrait m'afficher
Quote
sms
2
coucou

Je ne me souviens plus j'ai ca, mais c'est dans le ca ou il y a deux espaes. Il faut qu'il ignore tout ce qu'il y a après le troisème mots
%*[ ]%[^\n]


Si je tape

sms 2 coucouc

dans mon terminal

les serialString m'affichent
Quote
sms
3%
{vide}

8  International / Français / Mon Mac crash quand j'utilise Arduino on: August 22, 2014, 12:59:06 pm
Bonjour,

J'ai un probleme de plus en plsu récurant.

J'avais avant un MacBook Pro. J'avais donc installé Arduino 1.0.3 ( je ne sais plus la version)

Maintenant j'ai acheté un MacBook Air 13'' (10.9.4) avec Arduino 1.0.5.

Quand j'utilise Arduino, mon Mac (neuf) crash (s'éteint complétement)



Ce qui m'énerve aussi, c'est que quand j'upload mon code, j'ai très souvent ce problème
Quote
Binary sketch size: 14,496 bytes (of a 30,720 byte maximum)
avrdude: stk500_recv(): programmer is not responding
Quote
Binary sketch size: 12,762 bytes (of a 30,720 byte maximum)
avrdude: stk500_cmd(): programmer is out of sync
Pourtant, dans menu->Serial Port, j'ai bien sélectionner /dev/tty.usbserial...
???

Avez vous une idée pourquoi???

J'ai installé donc Arduino 1.0.5 pour OSX et
et pilote FTDI
http://www.ftdichip.com/Drivers/VCP.htm
(I downlod the 2.2.18 version for x64)

My MAcbook Air ne crache quand j'upload le code mais quand j'exécute le code dans le terminal...

Avez-vous eu cette mauvaise expérience??
9  International / Français / Comment puis-je récupérer des string séparé par des espaces on: August 22, 2014, 09:50:48 am
Bonjour

J'aimerais envoyer une commande:

cmd opt text

dans mon terminal
Code:
void serialhwread(){
 
  i=0;
 
  if (Serial.available() > 0){           
    while (Serial.available() > 0) {
      inSerial[i]=(Serial.read());
      delay(10);
      i++;     
     }
   
    inSerial[i]='\0';
   
    if(!strncmp(inSerial,"sms",3)){
      sscanf(inSerial,"%*s%s%*[ ]%[^\n]",cmd, opt, text);
 
      Serial.println(cmd);
      Serial.println(opt);
      Serial.println(text);

    }
    inSerial[0]='\0';
    }
} // End serialhwread

Mon problème il est là

Code:
  if(!strncmp(inSerial,"sms",3)){
      sscanf(inSerial,"%*s%s%*[ ]%[^\n]",cmd, opt, text);
 
      Serial.println(cmd);
      Serial.println(opt);
      Serial.println(text);

    }
Je n'arrive pas à récupérer les 3 mots séparé par des espaces et je suppose que l'erreu vient de là
Code:
%*s%s%*[ ]%[^\n]
J'ai aucune idée comment corrigé ceci

Pourriez-vous m'aider?

Milles mercis
10  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 21, 2014, 04:45:40 am
Hello

@Hackscribble
no, all are at 9600.

@PaulS and and @Hackscribble ( and all who want)
You helped me and I thank you again, but I can not solve and make it working, this because I am not a expert.
Would you be agree to take a bit of your time to see my complete code? It will really help me because I know nobody, in my town or work, who know Arduino or C++.
I Put my files in https://github.com/pierrot10/sim908 and I added some comment to read how and where I see the problem
. I think it around the _cell variable and IsStringReceived() function

I will really appreciate your help :o)

I am sure, I will be able to  adapt all of my other functions quickly when it will be solved.
11  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 20, 2014, 12:34:04 pm
Ok, it's work very much better, but there is still a small problem aroud _cell.

I explain step by step.
Code:
void Sim908::initializeSim908()
{
// define the role of pin 8 and 7
        pinMode(_pinToPowerOnModule, OUTPUT);
pinMode(_dtr, OUTPUT);
        //pu pin 7 the LOW (dtr)
digitalWrite(_dtr,LOW);
        // Begin _cell (Serial) pin 2 and 3
_cell.begin(_baud_rate);
        //Powerup SIM908
powerOnSim908();
}
initializeSim908 call powerOnSim908 funtion
Code:
   uint8_t answer=0;
     // Put up pin 8 fro 3 sec to powerup SIM908
    digitalWrite(_pinToPowerOnModule,HIGH);
    delay(3000);
    // Put the pin 8 back down
    digitalWrite(_pinToPowerOnModule,LOW);

     if(_debug){
Serial.print(F("Powering up SIM908.\n")); 
}
    while(answer == 0){     // Send AT every two seconds and wait for the answer
    answer = sendATcommand("AT", "OK", 2000l);
    }
    if(_debug){
    Serial.print(F("SIM908 is powered on!\n")); 
}
}
powerOnSim908 call antoher funtion : sendAtCommand in order to continur while OK is received.
The problem is from that moment
Code:
int8_t Sim908::sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;
    // For debugin. It display a correct information
   if(_debug){
    Serial.print("WAITING FOR ANSWER \n");
       Serial.print("Expected answer: ");Serial.println(expected_answer);
       Serial.print("Timeout: ");Serial.println(timeout);
    }

    memset(response, '\0', 100);    // Initialice the string
   
    delay(100);
   
    while( _cell.available() > 0) _cell.read();    // Clean the input buffer
   
    if (ATcommand[0] != '\0')
    {
       // This is displaying
    if(_debug){
        Serial.print("Command: ");
        _cell.println(ATcommand);    // Send the AT command
        Serial.println("");
        }
    }

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        if(_cell.available() != 0){    // if there are data in the UART input buffer, reads it and checks for the asnwer
            // THE PROBLEM IS HERE
             response[x] = _cell.read();
            x++;
           // SEE MY COMMENT BELOW
           
Serial.print(F("*****************\n"));
Serial.print(F("RESPONSE : "));
            Serial.println(response);
            Serial.print(F("EXPECTED ANSWER : "));
            Serial.println(expected_answer);
            Serial.print(F("*****************\n"));
           
            if (strstr(response, expected_answer) != NULL)    // check if the desired answer (OK) is in the response of the module
            {
                answer = 1;
                 Serial.println(F("ANSWER RECEIVED : "));
                 Serial.println(F(""));
           
            }
        }else{
        if(_debug){
         //Serial.println(F("No data in UART"));
         }
        }
    }while((answer == 0) && ((millis() - previous) < timeout));    // Waits for the asnwer with time out

if(_debug){
Serial.println("");
Serial.print("Answer : ");
Serial.println(answer);
Serial.println("");
}

    return answer;

}
In my point of view this does not work
Code:
response[x] = _cell.read();
I think _cell.read() can not read correctly.

In my code I added this for debuging
Code:
Serial.print(F("*****************\n"));
Serial.print(F("RESPONSE : "));
            Serial.println(response);
            Serial.print(F("EXPECTED ANSWER : "));
            Serial.println(expected_answer);
            Serial.print(F("*****************\n"));
and Serial.print(F("RESPONSE : ")); is displaying "xü" like this, while it waiting for OK
Quote
****************
RESPONSE : x
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************
*****************
RESPONSE : xü
EXPECTED ANSWER : OK
*****************

12  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 20, 2014, 11:54:49 am
Hello,
Ok this very interessting because I already that exemple
Code:
GSM::GSM():_cell(_GSM_TXPIN_,_GSM_RXPIN_),_tf(_cell, 10),_status(IDLE)

And it compile without error!!!!!

Greate, I am ging to upload my code and see the result. I keep you informed  smiley-mr-green

Ca marche vachement mieux. Bravo. Toujours un petit bug, mais je vais chercher d'abord... Well done
13  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 20, 2014, 09:11:18 am
Ho yep, that's correct. I changed like this
Code:
void Sim908::initializeSim908()
{
pinMode(_pinToPowerOnModule, OUTPUT);
pinMode(_dtr, OUTPUT);
digitalWrite(_dtr,LOW);

SoftwareSerial _cell(_rxpin,_txpin);
_cell.begin(_baud_rate);

//powerOnSim908();

}

Thank a lot. I hope I provided enough information
14  Using Arduino / Programming Questions / Re: My serial port si not reading on: August 20, 2014, 09:04:05 am
Dear Hackscribe

Thank for your advise.
I moved this to the initializeSim908 function
Code:
pinMode(pinToPowerOnModule, OUTPUT);
pinMode(dtr, OUTPUT);
Now my constructor look like
Code:
Sim908::Sim908(int rxpin, int txpin, int baud_rate, int pinToPowerOnModule, int debug, int dtr)
{
_pinToPowerOnModule = pinToPowerOnModule;
_debug = debug;
_baud_rate = baud_rate;
_dtr = dtr;
_rxpin = rxpin;
_txpin = txpin;

};

Quote
You are creating a private instance of SoftwareSerial inside your object, and declaring / using a global instance in your program?
What do you mean? For now _cell is only using in my class

I followed you advise when you told me to remove the begin() from the method

Below there is _cell.begin. It the reason why I make it private
Code:
class Sim908{
private:
                ...
SoftwareSerial _cell;
Here is my initializeSim908 function
Code:
void Sim908::initializeSim908()
{
pinMode(pinToPowerOnModule, OUTPUT);
pinMode(dtr, OUTPUT);
digitalWrite(_dtr,LOW);

SoftwareSerial _cell(_rxpin,_txpin);
_cell.begin(_baud_rate);

//powerOnSim908();

}

What it suprise me, the error message state
Quote
/Users/pierrot/Documents/Arduino/libraries/Sim908/Sim908.cpp: In constructor 'Sim908::Sim908(int, int, int, int, int, int)':
/Users/pierrot/Documents/Arduino/libraries/Sim908/Sim908.cpp:7: error: no matching function for call to 'SoftwareSerial::SoftwareSerial()'

but the line Sim908.cpp:7 is my constructor :
Code:
Sim908::Sim908(int rxpin, int txpin, int baud_rate, int pinToPowerOnModule, int debug, int dtr) // line 7
{
_pinToPowerOnModule = pinToPowerOnModule;
_debug = debug;
_baud_rate = baud_rate;
_dtr = dtr;
_rxpin = rxpin;
_txpin = txpin;

};

and there is nothing about SoftwareSerial!!

Quote
I thought the earlier version of your software passed a pointer to the global instance into the constructor.  Why have you changed?

I think my error come from _cell but I can find it. Then I comment the code about the pointer in order to be concentred on the initializeSim908 function. When this part will be sure and working as if I would have done in my ino file.
Code:
SoftwareSerial cell(rxpin,txpin);
cell.begin();
cell.available()
cell.read();
Previosly I did like just above (in the ino file) and it worked, but now I would like to move
Code:
SoftwareSerial cell(rxpin,txpin);
cell.begin();
in a library and to be able to use (in the Sim908.cpp file)
_cell.available(), _cell.read as I was doing in an ino file. This is my main issue  smiley-roll-sweat

Do you understand me?
Thank for your help

15  Using Arduino / Programming Questions / My serial port si not reading on: August 20, 2014, 08:29:42 am
Dear All,

The condition _cell.available() retunr false and I do not understand why
Code:
        if(_cell.available() != 0){    // if there are data in the UART input buffer, reads it and checks for the asnwer
            response[x] = _cell.read();
            Serial.print(response[x]);
            x++;
           
            Serial.print(F("Response"));
            Serial.println(response);
            Serial.print(F("Expected answer"));
            Serial.println(expected_answer);
           
            if (strstr(response, expected_answer) != NULL)    // check if the desired answer (OK) is in the response of the module
            {
                answer = 1;
            }
        }else{
        if(_debug){
         Serial.println(F("No data in UART"));
         }
        }

In my .ino file I do have this
Code:
// GENERAL
int debug = true;
int pinToPowerOnModule = 8;
int dtr = 7;

// LED
int green = 12;
#define MSEC 500
#define MSEC_FAST 150

// SERIAL
int baud_rate = 9600;
int rxpin = 2;
int txpin = 3;
Sim908 sim908(rxpin, txpin, baud_rate, pinToPowerOnModule, debug, dtr);

My constructor look like:
Code:
Sim908::Sim908(int rxpin, int txpin, int baud_rate, int pinToPowerOnModule, int debug, int dtr)
{
pinMode(pinToPowerOnModule, OUTPUT);
pinMode(dtr, OUTPUT);
_pinToPowerOnModule = pinToPowerOnModule;
_debug = debug;
_baud_rate = baud_rate;
_dtr = dtr;
_rxpin = rxpin;
_txpin = txpin;

};
I also have an initialize function
Code:
void Sim908::initializeSim908()
{
//digitalWrite(_dtr,LOW);
SoftwareSerial _cell(_rxpin,_txpin);
_cell.begin(_baud_rate);
powerOnSim908();

}

in My Sim908.h file, I declare _call like this:
Code:
  Sim908.h - Library
*/

#ifndef Sim908_h
#define Sim908_h

#include <SoftwareSerial.h>
#include "Arduino.h"

class Sim908{
private:
int _pinToPowerOnModule;
//Stream* _cell;
SoftwareSerial _cell;
//SoftwareSerial* _cell;
int _debug;
int _baud_rate;
int _dtr;
int _rxpin;
int _txpin;


public:
Sim908(int rxpin, int txpin, int baud_rate, int pinToPowerOnModule, int debug, int dtr);
//Sim908(SoftwareSerial cell, int baud_rate, int pinToPowerOnModule, int debug, int dtr);
void initializeSim908();

void powerOnSim908();
int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout);
void blinkLed(int lPin, int nBlink, int msec);

};

#endif

The terminal display that error message:
Quote
/Users/pierrot/Documents/Arduino/libraries/Sim908/Sim908.cpp: In constructor 'Sim908::Sim908(int, int, int, int, int, int)':
/Users/pierrot/Documents/Arduino/libraries/Sim908/Sim908.cpp:6: error: no matching function for call to 'SoftwareSerial::SoftwareSerial()'
/Applications/Arduino.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.h:83: note: candidates are: SoftwareSerial::SoftwareSerial(uint8_t, uint8_t, bool)
/Applications/Arduino.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.h:48: note:                 SoftwareSerial::SoftwareSerial(const SoftwareSerial&)

NB: In my Sim908.h and Sim908.cpp I added that line #include "SoftwareSerial.h"

So _cell.available or _cell.read should work as if in my .ino file, I would use that?

SoftwareSerial cell(rxpin,txpin);
cell.begin();
cell.available()
cell.read();

Do you see somethink wrong?

Thank a lot
Pages: [1] 2 3 ... 27