Arduino的GSM GPS盾不做GSM_READY检查 [英] Arduino GSM GPS Shield doesn't do the GSM_READY check

查看:481
本文介绍了Arduino的GSM GPS盾不做GSM_READY检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在你标记这个问题是重复的,请注意,我已经尝试<一个href=\"http://arduino.stackexchange.com/questions/5008/arduino-gsm-shield-gsm-ready-not-ready-ever?rq=1\">this, <一href=\"http://arduino.stackexchange.com/questions/4434/arduino-gsm-shield-not-responding?rq=1\">this &安培; <一href=\"http://arduino.stackexchange.com/questions/20481/sendsms-example-sketch-hangs-at-pinmunber-if-statement\">this

Before you mark this question as duplicate, please note that I have already tried this, this & this

我买了一个Arduino UNO R3和放大器;一个SIM808 GSM / GPS屏蔽最近。盾的RX连接到Arduino的,TX的针脚11至10引脚与两个相互连接的GND中。我已经连我的Arduino我的电脑用USB和放大器;屏蔽被连接到一个12V适配器的外部电源。此外,我已经连接了的Arduino的3.3V至Vcc屏蔽的。

I bought an Arduino UNO R3 & a SIM808 GSM/GPS shield recently. The RX of the Shield is connected to Pin 11 of Arduino, TX to Pin 10 with both the GNDs connected to each other. I have connected my Arduino to my computer with the USB & the shield is connected to an external power supply with a 12V Adapter. Additionally, I have connected the 3.3V of the Arduino to Vcc of the shield.

以下是我用素描:

// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop() {

  Serial.print("Enter a mobile number: ");
  char remoteNum[20];  // telephone number to send sms
  readSerial(remoteNum);
  Serial.println(remoteNum);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[]) {
  int i = 0;
  while (1) {
    while (Serial.available() > 0) {
      char inChar = Serial.read();
      if (inChar == '\n') {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if (inChar != '\r') {
        result[i] = inChar;
        i++;
      }
    }
  }
}

这里的问题是相同于那些与讯息提及。

Problem here is same as that mentioned in those linked posts.

的条件,如果(gsmAccess.begin(PINNUMBER)== GSM_READY)永远不会被执行。无论是否在其他部分执行。

The condition if (gsmAccess.begin(PINNUMBER) == GSM_READY) never gets executed. Neither does the else part execute.

系列显示器永远不会过去的短信发件人

Serial monitor never goes past SMS Messages Sender.

请注意,我用印度Airtel,我有一个完全激活的数据计划和放大器; PIN号码已更改为0000。

Please note that I am using AirTel India, I have a fully activated Data Plan & the PIN Number has been changed to 0000.

真的会AP preciate如果有人能提出一些有帮助的。

Would really appreciate if someone could suggest something helpful.

感谢您的时间!

推荐答案

请首先检查模块与下一个code的例code

Please first check if the module responds with the next code Example Code

其他的事情电源电压范围必须为3.4〜4.4V,尽量不要使用较小的电压。

Other thing the Supply voltage range must be 3.4 ~ 4.4V, try not using less voltage .

这篇关于Arduino的GSM GPS盾不做GSM_READY检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆