This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MIT app invertor and energia

Other Parts Discussed in Thread: ENERGIA

Hello there. I am currently trying to control 2 LEDs using MSP 432 coded by energia program. A bluetooth modem is connected to the MSP 432 and is controlled by a MIT app inventor phone application. My MIT app inventor program is shown below. The problem is that LED1 ON, LED2 ON, LED1 OFF and LED2 OFF do not send the signals promptly when clicked. My energia codes are shown below as well. Please help me. Thanks in advance.

ENERGIA CODES:

TAB 1:

void setup()

{

  pinMode(40,OUTPUT);

   pinMode(39,OUTPUT);

  Serial.begin(9600);

  Serial1.begin(9600);

}

 

void loop()

{

  while(Serial1.available()>0)

  {

    char message =Serial1.read();

    if(message==1)

    {

      digitalWrite(40,HIGH);

      Serial.println('1');

    }

    else if (message==2) 

    {

      digitalWrite(40,LOW);

      Serial.println('2');      

    }

    else

    {

      Serial.println(message);

    }

  }

 

 

 

 

 

 

TAB 2:

 

void setup()

{

  pinMode(39,OUTPUT);

   pinMode(40,OUTPUT);

  Serial.begin(9600);

  Serial1.begin(9600);

}

 

void loop()

{

  while(Serial1.available()>0)

  {

    char message =Serial1.read();

    if(message==3)

    {

      digitalWrite(39,HIGH);

      Serial.println('3');

    }

    else if (message==4) 

    {

      digitalWrite(39,LOW);

      Serial.println('4');      

    }

    else

    {

      Serial.println(message);

    }

  }

  • Justin,

       Can you characterize or quantify the delay between the API call and the actual LED toggle?  How does this compare with latency you expect from the serial communication to the actual setting of the bit in the port register?

      Can you do a direct write to the port register instead of using the API to see what the overhead associated with the API is?  Also, do you know what is your MCLK frequency and flash wait-state settings?

    Thanks and Regards,
    Chris

**Attention** This is a public forum