Go Down

Topic: how to use Cellular Shield with SM5100B (Read 8 times) previous topic - next topic

PaulS

Your code snippet indicates that you are using the hardware serial instance Serial, but the error message says you are using a NewSoftSerial instance.

If you have a NewSoftSerial instance named mySerial, you can send ctrl-z this way:
Code: [Select]
byte ctrlz = 26;
mySerial.print(ctrlz);

dozer

Thx worked great

found this just
cell.print(0x1A, BYTE);
also worked to send the ctrlz

tvix

Hi I've got a problem, Im using a Mega2560 and it s not working.
Does anyone knows how to solve this problem.
I'm testing the code below , but the problem is the pin, cause I've read somewhere that i can not use the pin D0 to d9 as  serial. And I don t know how to solve it.
/*
SparkFun Cellular Shield - Pass-Through Sample Sketch
SparkFun Electronics
Written by Ryan Owens
3/8/10


#include <NewSoftSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h>         //Used for string manipulations

char incoming_char=0;      //Will hold the incoming character from the Serial Port.

NewSoftSerial cell(19,18);  //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

void setup()
{
 //Initialize serial ports for communication.
 Serial.begin(9600);
 cell.begin(9600);
 
 //Let's get started!
 Serial.println("Starting SM5100B Communication...");
}

void loop() {
 //If a character comes in from the cellular module...
 if(cell.available() >0)
 {
   incoming_char=cell.read();    //Get the character from the cellular serial port.
   Serial.print(incoming_char);  //Print the incoming character to the terminal.
 }
 //If a character is coming from the terminal to the Arduino...
 if(Serial.available() >0)
 {
   incoming_char=Serial.read();  //Get the character coming from the terminal
   cell.print(incoming_char);    //Send the character to the cellular module.
 }
}

PaulS

You've got 4 hardware serial ports on the Mega. Why do you need a software serial port, too?

Are you using the version of NewSoftSerial that was recently modified for the Mega? The "official" version does not work on the Mega.

tvix

Thank you PaulS. Now its working. Now i can sand sms and make calls.

Go Up