VNGIoTLab / Mbed 2 deprecated vbluno51_mbed_serial

Dependencies:   mbed

Committer:
vbluno_support
Date:
Sun Oct 15 16:31:53 2017 +0000
Revision:
0:4b3db0a05c69
Child:
1:cd16195807ca
Init code for Test Serial Communication (read and write)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vbluno_support 0:4b3db0a05c69 1 /*
vbluno_support 0:4b3db0a05c69 2 * Note: Use fw_daplink_vbluno51_release_1.0.1.bin or later version for
vbluno_support 0:4b3db0a05c69 3 * DAPLINK interface on the VBLUNO51 kit.
vbluno_support 0:4b3db0a05c69 4 */
vbluno_support 0:4b3db0a05c69 5
vbluno_support 0:4b3db0a05c69 6 #include "mbed.h"
vbluno_support 0:4b3db0a05c69 7
vbluno_support 0:4b3db0a05c69 8 /*For the VBLUno51 board*/
vbluno_support 0:4b3db0a05c69 9 #define PIN_TX p10
vbluno_support 0:4b3db0a05c69 10 #define PIN_RX p11
vbluno_support 0:4b3db0a05c69 11 #define PIN_LED p7
vbluno_support 0:4b3db0a05c69 12
vbluno_support 0:4b3db0a05c69 13 DigitalOut led(PIN_LED);
vbluno_support 0:4b3db0a05c69 14 Serial pc(PIN_TX, PIN_RX, 115200);
vbluno_support 0:4b3db0a05c69 15
vbluno_support 0:4b3db0a05c69 16 int main(void) {
vbluno_support 0:4b3db0a05c69 17
vbluno_support 0:4b3db0a05c69 18 pc.printf("VBLUno51: Test Serial communication.\n");
vbluno_support 0:4b3db0a05c69 19
vbluno_support 0:4b3db0a05c69 20 led = 1;
vbluno_support 0:4b3db0a05c69 21
vbluno_support 0:4b3db0a05c69 22 //No condition loop
vbluno_support 0:4b3db0a05c69 23 while(1) {
vbluno_support 0:4b3db0a05c69 24 if(pc.readable()) {
vbluno_support 0:4b3db0a05c69 25 pc.putc(pc.getc() + 1); // echo input back to terminal
vbluno_support 0:4b3db0a05c69 26 led = !led;
vbluno_support 0:4b3db0a05c69 27 }
vbluno_support 0:4b3db0a05c69 28 }
vbluno_support 0:4b3db0a05c69 29 }