.

https://www.mediafire.com/file/sjhxgn70gxshilg/protocol_spi_pwm.png/file

Committer:
mbed_official
Date:
Tue Jan 08 12:45:03 2019 +0000
Revision:
88:bea4f2daa48c
Parent:
87:4c31b7ef1391
Child:
98:f2d7e14c84a1
Merge pull request #155 from deepikabhavnani/print_fix

Set the baudrate to default and reduce prints in blinky
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-blinky

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 82:abf1b1785bd7 1 /* mbed Microcontroller Library
mbed_official 82:abf1b1785bd7 2 * Copyright (c) 2018 ARM Limited
mbed_official 82:abf1b1785bd7 3 * SPDX-License-Identifier: Apache-2.0
mbed_official 82:abf1b1785bd7 4 */
mbed_official 82:abf1b1785bd7 5
Jonathan Austin 0:2757d7abb7d9 6 #include "mbed.h"
mbed_official 82:abf1b1785bd7 7 #include "stats_report.h"
Jonathan Austin 0:2757d7abb7d9 8
Jonathan Austin 0:2757d7abb7d9 9 DigitalOut led1(LED1);
Jonathan Austin 0:2757d7abb7d9 10
mbed_official 88:bea4f2daa48c 11 #define SLEEP_TIME 500 // (msec)
mbed_official 88:bea4f2daa48c 12 #define PRINT_AFTER_N_LOOPS 20
mbed_official 88:bea4f2daa48c 13
Jonathan Austin 1:846c97078558 14 // main() runs in its own thread in the OS
mbed_official 82:abf1b1785bd7 15 int main()
mbed_official 82:abf1b1785bd7 16 {
mbed_official 88:bea4f2daa48c 17 SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */);
mbed_official 82:abf1b1785bd7 18
mbed_official 88:bea4f2daa48c 19 int count = 0;
Jonathan Austin 0:2757d7abb7d9 20 while (true) {
mbed_official 82:abf1b1785bd7 21 // Blink LED and wait 0.5 seconds
Jonathan Austin 0:2757d7abb7d9 22 led1 = !led1;
mbed_official 88:bea4f2daa48c 23 wait_ms(SLEEP_TIME);
mbed_official 82:abf1b1785bd7 24
mbed_official 88:bea4f2daa48c 25 if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) {
mbed_official 88:bea4f2daa48c 26 // Following the main thread wait, report on the current system status
mbed_official 88:bea4f2daa48c 27 sys_state.report_state();
mbed_official 88:bea4f2daa48c 28 count = 0;
mbed_official 88:bea4f2daa48c 29 }
mbed_official 88:bea4f2daa48c 30 ++count;
Jonathan Austin 0:2757d7abb7d9 31 }
Jonathan Austin 0:2757d7abb7d9 32 }