Go Down

Topic: Transparent bridge between Arduino terminal and the M10 (Read 1 time) previous topic - next topic

Palliser

I don't know if the following have been discussed/noted here but I considered useful to share it.

For small applications that only require a few AT commands, I use a simple sketch that allows me to access the M10 using AT commands. In other words, the sketch will provide a transparent bridge between the Arduino terminal (with Newline) and M10. It means that you will be able to type AT commands on the terminal and the modem will reply accordingly.

Here the sketch:

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial GPRS(2, 3);
unsigned char buffer[64];
int count=0;

void setup()
{
  GPRS.begin(9600);
  Serial.begin(9600);

}

void loop()
{
  if (GPRS.available())
  {
    while(GPRS.available())
    {
      buffer[count++]=GPRS.read();
      if(count == 64)break;
  }
    Serial.write(buffer,count);
    clearBufferArray();
    count = 0;
  }
  if (Serial.available())
    GPRS.write(Serial.read());
}
void clearBufferArray()
{
  for (int i=0; i<count;i++)
    { buffer[i]=NULL;}         
}


Regars, Palliser

Go Up