It uses the class timer and call some of the methods it provides
Dependencies: mbed
main.cpp@1:e55867cf61fe, 2018-11-09 (annotated)
- Committer:
- StefanoArrigoni
- Date:
- Fri Nov 09 11:22:48 2018 +0000
- Revision:
- 1:e55867cf61fe
- Parent:
- 0:aaf2ecbd9afc
The comment * Organization: Perlatecnica no-profit organization * has been removed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
perlatecnica | 0:aaf2ecbd9afc | 1 | /**************************************************** |
perlatecnica | 0:aaf2ecbd9afc | 2 | * FAST PROTOTYPING WITH NUCLEO * |
perlatecnica | 0:aaf2ecbd9afc | 3 | * Example Code 03: Timer * |
perlatecnica | 0:aaf2ecbd9afc | 4 | * Author: Mauro D'Angelo * |
perlatecnica | 0:aaf2ecbd9afc | 5 | *****************************************************/ |
perlatecnica | 0:aaf2ecbd9afc | 6 | /*------------------------------------ |
perlatecnica | 0:aaf2ecbd9afc | 7 | * Hyperterminal configuration |
perlatecnica | 0:aaf2ecbd9afc | 8 | * 9600 bauds, 8-bit data, no parity |
perlatecnica | 0:aaf2ecbd9afc | 9 | *------------------------------------*/ |
perlatecnica | 0:aaf2ecbd9afc | 10 | |
perlatecnica | 0:aaf2ecbd9afc | 11 | #include "mbed.h" |
perlatecnica | 0:aaf2ecbd9afc | 12 | |
perlatecnica | 0:aaf2ecbd9afc | 13 | Timer timer; |
perlatecnica | 0:aaf2ecbd9afc | 14 | Serial pc(USBTX, USBRX); |
perlatecnica | 0:aaf2ecbd9afc | 15 | DigitalOut myled(LED1); |
perlatecnica | 0:aaf2ecbd9afc | 16 | |
perlatecnica | 0:aaf2ecbd9afc | 17 | |
perlatecnica | 0:aaf2ecbd9afc | 18 | int main() { |
perlatecnica | 0:aaf2ecbd9afc | 19 | timer.start(); |
perlatecnica | 0:aaf2ecbd9afc | 20 | int i = 1; |
perlatecnica | 0:aaf2ecbd9afc | 21 | pc.printf("Hello World !\n"); |
perlatecnica | 0:aaf2ecbd9afc | 22 | while(1) { |
perlatecnica | 0:aaf2ecbd9afc | 23 | wait(1); |
perlatecnica | 0:aaf2ecbd9afc | 24 | pc.printf("This program runs since %d seconds.\r\n", timer.read_ms()/1000); |
perlatecnica | 0:aaf2ecbd9afc | 25 | myled = !myled; |
perlatecnica | 0:aaf2ecbd9afc | 26 | } |
perlatecnica | 0:aaf2ecbd9afc | 27 | } |
perlatecnica | 0:aaf2ecbd9afc | 28 |