Új hozzászólás Aktív témák

  • Saua

    tag

    Sziasztok,
    egy SIM900 -as GSM modult próbálgatok, az [itt] található 55.3 -as példaprogrammal próbálkozom, Arduino IDE 1.0.5-r2 változatot használok

    a SIM900 így van összekötve az arduinóval: SIM900 7pin - Arduino7pin és SIM900 8 pin -Arduino 8 pin ... SIM900 -an a SW serial van kiválasztva
    // Example 55.3

    #include <SoftwareSerial.h>
    SoftwareSerial SIM900(7, 8);
    int x,y;
    String textForSMS;

    void setup()
    {
    SIM900.begin(19200);
    SIM900power();
    delay(20000); // give time to log on to network.
    randomSeed(analogRead(0));
    }

    void SIM900power()
    // software equivalent of pressing the GSM shield "power" button
    {
    digitalWrite(9, HIGH);
    delay(1000);
    digitalWrite(9, LOW);
    delay(7000);
    }

    void sendSMS(String message)
    {
    SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
    delay(100);
    SIM900.println("AT + CMGS = \"+12128675309\""); // recipient's mobile number, in international format
    delay(100);
    SIM900.println(message); // message to send
    delay(100);
    SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
    delay(100);
    SIM900.println();
    delay(5000); // give module time to send SMS
    SIM900power(); // turn off module
    }

    void loop()
    {
    x = random(0,255);
    y = random(0,255);
    textForSMS = "Your random numbers are ";
    textForSMS.concat(x);
    textForSMS = textForSMS + " and ";
    textForSMS.concat(y);
    textForSMS = textForSMS + ". Enjoy!";
    sendSMS(textForSMS);
    do {} while (1);
    }

    a telefonszámot változtattam meg a sebességet állítottam 9600 -ra
    a szoftveres bekapcsolást nem használtam void SIM900power(), a lapon levő gombbal kapcsolom be... nem akar működni. Tanácsokat szeretnék kérni a probléma megoldására. Esetleg a SoftwareSerial.h könyvtárral lehet a gond?
    Ugyanzen az oldalon levő másik program Making a telephone call from your Arduino (Example 55.1) jól működik.

Új hozzászólás Aktív témák

Hirdetés