Muhammad Atir Sharif / Mbed 2 deprecated ticker

Dependencies:   mbed

main.cpp

Committer:
atir_sharif
Date:
2022-01-08
Revision:
1:71b75f1d31ca
Parent:
0:06ea14e458e3

File content as of revision 1:71b75f1d31ca:

/*Program 5: Reads input voltage through the ADC, and transfers to PC terminal */
#include "mbed.h"

Serial pc(USBTX, USBRX); //enable serial port which links to USB
AnalogIn Ain(p20);
Timer t;
float tim;
char a[20];
unsigned char count;

int main() {
//    pc.printf("ADC Data Values…\n\r"); //send an opening text message 
    while(1){
        pc.scanf("%s", &a);
        t.start();
        pc.printf("%s \n\r", &a); //send the data to the terminal
        t.stop();
        pc.printf("The time taken was %f seconds\n", t.read());
        tim = t.read();
        count = strlen(a);
        tim /= count;
        pc.printf("The time taken for one charater %f seconds\n", tim);
    }
}