Communication with a mobile phone

Good evening, it’s been several days trying to establish a connection (wired) between a mobile phone and a Duemilanove arduino card.

  1. I first used the terminals 0 and 1 for RX and TX, but I had some error, so I used the terminals 11 and 10, could I keep the originals pines? I don’t think so
  2. Using other pins that I use the library <NewSoftSerial.h> like this:

#include<NewSoftSerial.h>
#define rxPin 11
#define txPin 10

NewSoftSerial mySerial(rxPin, txPin);

const int Led_rouge = 8;
void setup(){
pinMode(Led_rouge, OUTPUT);
mySerial.begin(9600);
mySeial.println(“AT+CPIN=0409”);
}

void loop(){
if(mySerial.available()){
digitalWrite(Led_rouge, HIGH);
}
}

I know the PIN code is sent to mobile phone but I can’t receive the response from mobile phone, it should return “OK”.
There is something wrong in this program but where?

Thank you in advance

please post your actual code, a description of what you want to achieve, and of what happens when you try.

I only half guess that you believe you buggered up pins 1 & 2 … not sure.

I know the code below does no compile… so it is not the code you use really.

Copy it from the editor into a code entry (the button with a ‘#’ - 3rd last above the smilies)

Use preview to see if it worked.

Below is your code copied into a code block.

#include<NewSoftSerial.h>
#define rxPin 11
#define txPin 10

NewSoftSerial mySerial(rxPin, txPin);

const int Led_rouge = 8;
void setup(){
     pinMode(Led_rouge, OUTPUT);
     mySerial.begin(9600);
     mySeial.println("AT+CPIN=0409");
}

void loop(){
    if(mySerial.available()){
    digitalWrite(Led_rouge, HIGH);
    }
}
[#include <NewSoftSerial.h>
#define rxPin 11 
#define txPin 10

NewSoftSerial mySerial(rxPin, txPin);
const int Led_rouge=8;
const int Led_verte=9;

void setup(){
  
  mySerial.begin(9600);
  Serial.begin(9600);
  pinMode(Led_rouge, OUTPUT);
  pinMode(Led_verte, OUTPUT);
  mySerial.println("AT+CPIN=0409");
  
}
void loop(){
  if(mySerial.available()){
    digitalWrite(Led_rouge, HIGH);
    Serial.print(mySerial.read(),BYTE);
  }
}






code]

This is my code, I could send data but can’t receive any response

So nobody can help me? It's important, this is for my work graduation. Thanks in advance.

Have you tried interacting directly with the phone using a terminal program?

Yes, of course. I have already done this work in bascom, so I know the response of the mobile phone

I know the PIN code is sent to mobile phone

How do you know? Does the phone have some indicator?

Instead of this…

mySerial.println(“AT+CPIN=0409”);

…try this…

mySerial.print(“AT+CPIN=0409\r”);

Actually, I use a mobile phone module. On it, once it received his PIN, a red LED blinks. So "AT+CPIN=0409" is OK

Ok - dont know if you are still waiting for an answer here...