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); } } }
↧