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.
5 years, 9 months ago.
UART communication in FRDM k64F
Hi, I need to send this command
uint8_t txbuff[] = "coap CON GET fd61:7409:e1d2:56f2:fd27:3426:5a6b:5f93 /temp\n";
through uart pin of K64F.(PTC 17) to KW41z board. I tried passing it using an array but was not successful. Any pointers on how to do this.
Thanks and Regards Niranjan
1 Answer
5 years, 9 months ago.
Hello Niranjan,
You can try the code below:
#include "mbed.h" DigitalOut led1(LED1); Serial serial(PTC17, PTC16); char message[] = "coap CON GET fd61:7409:e1d2:56f2:fd27:3426:5a6b:5f93 /temp\n"; // the compiler silently appends a null char (0x00) int main() { // serial.baud(115200); // Uncomment this line to change the bitrate from default (9600) to 115200 serial.printf("%s", message); // Uncomment the lines below to send the message periodically each second // while(true) // { // wait(1.0); // led1 = !led1; // serial.printf("%s", message); // } }
Rmember to connect K64F's Tx line (pin PTC17) to KW41z's Rx line.