ช่วยด้วยครับ arduino mega 1280 + sim900 ไม่ทำงานครับ

Started by olak_ole, February 14, 2014, 09:32:07 PM

Previous topic - Next topic

olak_ole

ผมได้ทำการเขียนโปรแกรมใส่เข้าไปยัง arduino เรียบร้อยแล้วครับ

ตามนี้เลย

#include <SoftwareSerial.h>
SoftwareSerial SIM900(15,14); // RX | TX
void setup()
{
  SIM900.begin(9600);
  Serial.begin(9600);
}

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");
  delay(500);  // AT command to send SMS message
  SIM900.println("AT+CMGS=\"+6684503xxxx\"\r");                                     // recipient's mobile number, in international format
  delay(500);
  SIM900.println("Arduino");        // message to send
  delay(500);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(500);

}

void loop()
{
  sendSMS();
  do {} while (1);
}

จากนั้นผมก็ต่อ tx ขา 14 ของ arduino เข้า rx ของ sim900 และต่อ rx ขา 15 เข้า tx ของ sim900
แต่ทดสอบแล้วไม่ส่งข้อความตามที่เขียนเลยครับ
เงียบกริ๊ปเลย
ไม่ทราบว่าผมทำผิดขั้นตอนไหนมั้ยครับ
ขอคำแนะนำจากอาจารย์ทุกท่านด้วยครับ


JENG

sim900 baud rate เท่าใด fix หรือ auto ถ้า auto ต้อง sync command AT ก่อน
ต่อ rx/tx sim900 port ไหน วงในรูปให้ดูหน่อย หรือดูคู่มือแล้วบอกก็ได้
สามารถติดตาม electoday ได้ที่

Facebook
www.facebook.com/groups/coopmicro

Google+
https://plus.google.com/communities/103482067769375459277

☺☺☺ความรู้ และความฉลาด ไม่ใช่สิ่งเดียวกัน จะมีประโยชน์อะไร ถ้าฉลาดแต่อยู่ในกะลา☺☺☺


prakit340

ดูขา Serial ให้ดีนะครับ เรื่อง SoftwareSerial

ไม่แน่ใจ 1280 เป็น Rx3 Tx3 หรือป่าว ทำไมต้องใช้  SoftwareSerial ที่ขา 14 15 ใน 2560 มันเป็น Serial 3 แต่ถ้า 1280 ใช่ ทำไมต้องใช้ SoftwareSerial

ก็เลยงงนิดหน่อย ลองเช็คดูนะครับ

Arduitronics.com