Hi,

I am trying to send a series of commands to the PC hyperterminal using UART 
interface. Now when I send a single command it works fine. But when I send a 
series of commands it stops working. I have tried to create delays after each 
command but still it does not work. Can anyone tell me what I can possibly do?

Here is my code :

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
{

// COMMANDS TO BE SENT
char* uartsendBuf1 = "AT\n";
char* uartsendBuf2 = "AT+CMGF=1\n";
char* uartsendBuf3 = "AT+CMGS=";
char* uartsendBuf4 = "+6590140252";
char* output = "Hello";
char* input;
uint16_t inputlen;
uint8_t recevedByte;

  event void Boot.booted() {

    call UartInit.init();

    call Timer.startPeriodic(3000);
    call UartControl.start();

  }


static void delay(uint32_t cycles)
  {
    while (--cycles > 0)
    {
      //nop();
    }
  }

      event void Timer.fired() {


    call UartControl.start();
    call UartStream.send(uartsendBuf1, 3);
    /*call Leds.led1Toggle();                              // This part does 
not work
    delay(5000);
    call UartControl.start();
    call UartStream.send(uartsendBuf2, 10);
    call Leds.led1Toggle();
    delay(5000);
    call UartControl.start();
    call UartStream.send(uartsendBuf3, 8);
    call Leds.led1Toggle();
    delay(5000);
    call UartControl.start();
    call UartStream.send(uartsendBuf4, 11);
    call Leds.led1Toggle();
    delay(5000); */
  }



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

    call Leds.led0Toggle();
    call UartStream.enableReceiveInterrupt();

  }

  async event void UartStream.receivedByte( uint8_t byte )
  {

  if( (char* )byte == "a")
  {
  call Leds.led1Toggle();
  }
  call Leds.led2Toggle();
  recevedByte = byte;
  call UartControl.stop();

  }

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

  }

}

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to