Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F746NG BSP_DISCO_F746NG Graphics
main.cpp@0:612209585c31, 2019-08-24 (annotated)
- Committer:
- ngtkien
- Date:
- Sat Aug 24 17:12:53 2019 +0000
- Revision:
- 0:612209585c31
- Child:
- 2:447f54400c21
Initial Digital SignalAlgorithm
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ngtkien | 0:612209585c31 | 1 | #include "mbed.h" |
| ngtkien | 0:612209585c31 | 2 | |
| ngtkien | 0:612209585c31 | 3 | /*------------------------------------------------------------------------------ |
| ngtkien | 0:612209585c31 | 4 | Before to use this example, ensure that you an hyperterminal installed on your |
| ngtkien | 0:612209585c31 | 5 | computer. More info here: https://developer.mbed.org/handbook/Terminals |
| ngtkien | 0:612209585c31 | 6 | |
| ngtkien | 0:612209585c31 | 7 | The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their |
| ngtkien | 0:612209585c31 | 8 | definition in the PinNames.h file). |
| ngtkien | 0:612209585c31 | 9 | |
| ngtkien | 0:612209585c31 | 10 | The default serial configuration in this case is 9600 bauds, 8-bit data, no parity |
| ngtkien | 0:612209585c31 | 11 | |
| ngtkien | 0:612209585c31 | 12 | If you want to change the baudrate for example, you have to redeclare the |
| ngtkien | 0:612209585c31 | 13 | serial object in your code: |
| ngtkien | 0:612209585c31 | 14 | |
| ngtkien | 0:612209585c31 | 15 | Serial pc(SERIAL_TX, SERIAL_RX); |
| ngtkien | 0:612209585c31 | 16 | |
| ngtkien | 0:612209585c31 | 17 | Then, you can modify the baudrate and print like this: |
| ngtkien | 0:612209585c31 | 18 | |
| ngtkien | 0:612209585c31 | 19 | pc.baud(115200); |
| ngtkien | 0:612209585c31 | 20 | pc.printf("Hello World !\n"); |
| ngtkien | 0:612209585c31 | 21 | ------------------------------------------------------------------------------*/ |
| ngtkien | 0:612209585c31 | 22 | |
| ngtkien | 0:612209585c31 | 23 | DigitalOut led(LED1); |
| ngtkien | 0:612209585c31 | 24 | |
| ngtkien | 0:612209585c31 | 25 | int main() |
| ngtkien | 0:612209585c31 | 26 | { |
| ngtkien | 0:612209585c31 | 27 | int i = 1; |
| ngtkien | 0:612209585c31 | 28 | |
| ngtkien | 0:612209585c31 | 29 | printf("Hello World !\n"); |
| ngtkien | 0:612209585c31 | 30 | |
| ngtkien | 0:612209585c31 | 31 | while(1) { |
| ngtkien | 0:612209585c31 | 32 | wait(1); // 1 second |
| ngtkien | 0:612209585c31 | 33 | led = !led; // Toggle LED |
| ngtkien | 0:612209585c31 | 34 | printf("This program runs since %d seconds.\n", i++); |
| ngtkien | 0:612209585c31 | 35 | } |
| ngtkien | 0:612209585c31 | 36 | } |