Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - olak_ole

#1
ผมได้ทำการเขียนโปรแกรมใส่เข้าไปยัง 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
แต่ทดสอบแล้วไม่ส่งข้อความตามที่เขียนเลยครับ
เงียบกริ๊ปเลย
ไม่ทราบว่าผมทำผิดขั้นตอนไหนมั้ยครับ
ขอคำแนะนำจากอาจารย์ทุกท่านด้วยครับ
#2
พอดีผมทำโปรเจคให้อาหารสุนัขโดยส่งข้อความเข้าเข้า sim 900 แล้วให้เครื่องทำงานครับ
แต่ติดปัญหาตรงที่ว่า เราจะเขียนโปรแกรมตรวจสอบข้อความที่ต้องการอย่างไรครับ
อย่างเช่นส่งข้อความให้ sim 900 ว่า "open" แล้วเครื่องก็จะให้อาหารตามที่เรากำหนดแล้วหยุดเองอัตโนมัติประมาณนี้ครับ
ผมเคยใช้แต่ pic ส่งข้อความออกไปครับ แต่ยังไม่เคยรับข้อความมาประมวลผลเลยครับ

ขอคำชี้แนะจากอาจารย์ทั้งหลายด้วยครับ

ปล.ผมใช้โปรแกรม ccs เขียนครับผม
#3
พอดีผมได้เขียนโปรแกรม RC switch ครับ
ตอนนี้สามารถเปิดปิดไฟได้แล้ว แต่ปัญหาติดตรงที่ว่า
ถ้าเราไม่ได้ต่อสายเข้ารีซีฟเวอร์ คือไม่มีพัลส์เข้า arduino ไฟมันติดตลอดเลยครับ
ผมอยากจะให้ไฟมันดับตอนที่ไม่มีพัลส์เข้ามา
ไม่ทราบว่ามีคำสั่งอะไรที่ใช้ตรวจสอบมั้ยครับ

ผมแนบโค๊ดที่เขียนมาให้ด้วยครับ

int ch1; // Here's where we'll keep our channel values
int tx = 0;
void setup() {

pinMode(0, INPUT); // Set our input pins as such
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
 
}

void loop() {
 
  ch1 = pulseIn(tx, HIGH, 25000); // Read the pulse width of
 
     if((ch1>1350)&&(ch1<1650))
   {
     digitalWrite(4, LOW); 

   }

else
     {
     digitalWrite(4, HIGH); 

    }


}
#4
ท่านใดมีโพสไว้เลยนะครับ
จะนำมาเริ่มเรียนรู้ซักหน่อย อิอิ ;D :D