Dependencies:   mbed

Committer:
gr91
Date:
Thu May 14 15:51:47 2020 +0000
Revision:
0:4a721db37680
MB2LV : MBED to labVIEW demo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gr91 0:4a721db37680 1 #include "mbed.h"
gr91 0:4a721db37680 2 #define PI 3.14f
gr91 0:4a721db37680 3 Serial pc(SERIAL_TX, SERIAL_RX);
gr91 0:4a721db37680 4 Ticker mesure;
gr91 0:4a721db37680 5 bool f_mesure=0 ;// flag ticker
gr91 0:4a721db37680 6 void t_mesure()
gr91 0:4a721db37680 7 {
gr91 0:4a721db37680 8 f_mesure=1;
gr91 0:4a721db37680 9 }
gr91 0:4a721db37680 10
gr91 0:4a721db37680 11 DigitalOut led(LED1);
gr91 0:4a721db37680 12
gr91 0:4a721db37680 13 int main()
gr91 0:4a721db37680 14 {
gr91 0:4a721db37680 15 pc.baud(9600);
gr91 0:4a721db37680 16 pc.printf("Hello World !\n");
gr91 0:4a721db37680 17 mesure.attach(&t_mesure,0.1);
gr91 0:4a721db37680 18 int i = 0;
gr91 0:4a721db37680 19 while(1) {
gr91 0:4a721db37680 20 if(f_mesure) {
gr91 0:4a721db37680 21 pc.printf("%f %f\r\n", sin(2*PI*i/100),cos(2*PI*i/100));
gr91 0:4a721db37680 22 i++;
gr91 0:4a721db37680 23 f_mesure=0;
gr91 0:4a721db37680 24 }
gr91 0:4a721db37680 25 }
gr91 0:4a721db37680 26 }