test

Dependencies:   mbed

Committer:
Sim
Date:
Fri Mar 22 18:12:07 2019 +0000
Revision:
0:948b4deb5b40
old library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sim 0:948b4deb5b40 1 #include "mbed.h"
Sim 0:948b4deb5b40 2
Sim 0:948b4deb5b40 3 DigitalOut myled(LED_GREEN);
Sim 0:948b4deb5b40 4 Serial pc(USBTX, USBRX);
Sim 0:948b4deb5b40 5
Sim 0:948b4deb5b40 6 int main()
Sim 0:948b4deb5b40 7 {
Sim 0:948b4deb5b40 8 int i = 0;
Sim 0:948b4deb5b40 9 pc.baud(115200);
Sim 0:948b4deb5b40 10 pc.printf("Hello World!\n");
Sim 0:948b4deb5b40 11
Sim 0:948b4deb5b40 12 while (true) {
Sim 0:948b4deb5b40 13 wait(0.5f); // wait a small period of time
Sim 0:948b4deb5b40 14 pc.printf("%d \n", i); // print the value of variable i
Sim 0:948b4deb5b40 15 i++; // increment the variable
Sim 0:948b4deb5b40 16 myled = !myled; // toggle a led
Sim 0:948b4deb5b40 17 }
Sim 0:948b4deb5b40 18 }