Hi,

I am trying to send a SMS via a gsm modem(ADH8066) interfaced with an IRIS 
mote. I have the GSM modem working with AT commands using hyper-terminal. I 
also have the UART interface between the IRIS mote and the PC working with the 
mote sending AT commands to the hyper-terminal. However now when I connect the 
mote and the GSM modem, it does not work. I have checked the power supply for 
GSM modem which seems fine. All the baud settings are also correct.

I am not sure what I could be missing..Could it be something to do with CTS,DTR 
?Can anyone please advise me as to how I should progress? It would be of great 
help.

Here is my code :

#include "printf.h"

module GSMmodemC @safe()
{
  uses interface Boot;
  uses interface Init as UartInit;
  uses interface StdControl as UartControl;
  uses interface UartStream;
  uses interface Leds;
  uses interface Timer<TMilli>;

}
implementation
{

enum {
    UART_BUF_MAXLEN = 15
};

char* uartsendBuf1 = "AT\n\r";
char* uartsendBuf2 = "AT+CMGF=1\n\r";
char* uartsendBuf3 = "AT+CMGS=";
char* uartsendBuf4 = "+6590140252";
char* newline = "\n\r";
char* msg = "Hello";
uint8_t recevedByte;
uint8_t stage = 0;
uint8_t flag = 0;
uint8_t uartBuf[UART_BUF_MAXLEN];
/** Count of bytes read into #uartBuf during a reading. */
uint8_t uartBufCount;

  event void Boot.booted() {

    call UartInit.init();
    call Timer.startPeriodic(3000);
    call UartControl.start();
    //call Timer.startPeriodic(2000);

  }

    event void Timer.fired() {


    switch (stage) {
        case 0:
        call UartControl.start();
        call UartStream.send(uartsendBuf1, 4);
        break;
        case 1:
        call UartControl.start();
        call UartStream.send(uartsendBuf2, 11);  //at+cmgf=1
        break;
        case 2:
        call UartControl.start();
        call UartStream.send(uartsendBuf3, 8); // at+cmgs=
            break;
        case 3:
        call UartControl.start();
        call UartStream.send(0x22,1);   // "
        break;
        case 4:
        call UartControl.start();
        call UartStream.send(uartsendBuf4,11);  //phone number
        break;
        case 5:
        call UartControl.start();
        call UartStream.send(0x22,1);  // " ""
        break;
        case 6:
        call UartControl.start();
        call UartStream.send(newline,2); //newline
        break;
        case 7:
        call UartControl.start();
        call UartStream.send(msg,5);  //message
        break;

        case 8:
        call UartControl.start();
        call UartStream.send(0x1A, 1);   //comtrol z
        break;


    }

    }


  async event void UartStream.sendDone( uint8_t* buf, uint16_t len, error_t 
error )
  {
    call Leds.led2Toggle();
    stage++;
    if (stage > 8)
    {
    stage = 0;
    }

    call UartControl.stop();

  }

  async event void UartStream.receivedByte( uint8_t byte )
  {
   }


  async event void UartStream.receiveDone( uint8_t* buf, uint16_t len, error_t 
error )
  {
  }

}

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to