EXP5

Dependencies:   mbed

Committer:
rx5
Date:
Tue Apr 12 06:09:52 2016 +0000
Revision:
0:f7e8526b7b4f
MEFGI RAJKOT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rx5 0:f7e8526b7b4f 1 #include "mbed.h"
rx5 0:f7e8526b7b4f 2 Serial pc(USBTX, USBRX); // Initlize UART on USB port of KL25Z with default Baud 9600
rx5 0:f7e8526b7b4f 3
rx5 0:f7e8526b7b4f 4 int main()
rx5 0:f7e8526b7b4f 5 {
rx5 0:f7e8526b7b4f 6 int i=0;
rx5 0:f7e8526b7b4f 7 float f=0;
rx5 0:f7e8526b7b4f 8 // pc.baud(115200); // uncomment this line and update baudrate to cahnge baud rate from 9600 default
rx5 0:f7e8526b7b4f 9 pc.printf("\r\n"); // print startup message from new line on UART Terminal
rx5 0:f7e8526b7b4f 10 pc.printf("Experiment - 5\r\n"); // print startup message on UART Terminal
rx5 0:f7e8526b7b4f 11 pc.printf("UART Interfacing\r\n"); // print startup message on UART Terminal
rx5 0:f7e8526b7b4f 12 wait(3.0); // wait 3 second to show startup message
rx5 0:f7e8526b7b4f 13 while(1) // loop forever
rx5 0:f7e8526b7b4f 14 {
rx5 0:f7e8526b7b4f 15 pc.printf("Int i = %d \t Float f = %0.2f \r\n",i,f); // print value of i and f on UART Terminal
rx5 0:f7e8526b7b4f 16 i=i+1; // update i
rx5 0:f7e8526b7b4f 17 f=f+0.01; // update f
rx5 0:f7e8526b7b4f 18 wait(1.0); // Wait for 1 second
rx5 0:f7e8526b7b4f 19 }
rx5 0:f7e8526b7b4f 20
rx5 0:f7e8526b7b4f 21 }