2017年5月27日 星期六

LinkIt ONE: GSM 發送 SMS 簡訊

使用 GSM 功能時,請注意 LinkIt ONE 只支持 2G 訊號,所以請注意門號所屬的電信公司是否有支援 2G 基地台。

設置天線

請將 GSM 天線設置在模組上。

Arduino

#include <LGSM.h>                // Include Linkit ONE GSM library

void setup() {

  Serial.begin(115200);                 // Initializes serial port at 115200 bauds

  Serial.println("Starting Send SMS!"); // Start the Send SMS program
  while (!LSMS.ready())                 // 等待 SIM(SMS) 準備好
  {
    delay(1000);                        // Wait for a second and then try again
  }
  
  Serial.println("Sim initialized");    // When SIM is started, print "Sim initialized" in the serial port

  LSMS.beginSMS("手機號碼");          // Saves the number where user wants to send SMS. To be changed before uploading sketch
  LSMS.print("Hello World");                  // Prepare message variable to be sent by LSMS

  if (LSMS.endSMS())                  // If so, send the SMS
  {
    Serial.println("SMS sent");    // Print "SMS sent" in serial port if sending is successful
  }
  else
  {
    Serial.println("SMS is not sent");// Else print "SMS is not sent"
  }
}

Reference:
http://pansci.asia/archives/85424
https://www.youtube.com/watch?v=-NxdA6cpp8g
https://stackoverflow.com/questions/40341976/linkit-one-gprs-server
https://docs.labs.mediatek.com/resource/linkit-one/en
https://docs.labs.mediatek.com/resource/linkit-one/en/faq
http://pansci.asia/archives/85424
http://www.instructables.com/id/LinkIt-ONE-SMS-Tutorial/#step4

沒有留言:

張貼留言

© Mac Taylor, 歡迎自由轉貼。
Background Email Pattern by Toby Elliott
Since 2014