Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
two way serial communication
hello, i am trying to sending string with 3 character by serial monitor and it will print what i want. but problem is that when i am trying to send more than 3 character string (pc.gets(buffer, 5);) it cant print always on serial monitor. why?? here is my program:
- include "mbed.h"
Serial pc(USBTX, USBRX, 9600);
int main() { char buffer[128];
while(1) { pc.gets(buffer, 4); if(strcmp(buffer,"sam")==0) { pc.printf("Hii '%s'\nWELCOME TO ARM Mbed.\n\n", buffer);
} } }