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: mbed
main.cpp@0:40477eb0350c, 2016-02-22 (annotated)
- Committer:
- YCTung
- Date:
- Mon Feb 22 13:04:31 2016 +0000
- Revision:
- 0:40477eb0350c
- Child:
- 1:b63700fbbf1f
Robotics_Lab_LED
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| YCTung | 0:40477eb0350c | 1 | /*LAB_LED*/ |
| YCTung | 0:40477eb0350c | 2 | #include "mbed.h" |
| YCTung | 0:40477eb0350c | 3 | |
| YCTung | 0:40477eb0350c | 4 | //LED1 = D13 = PA_5 (LED on Nucleo board) |
| YCTung | 0:40477eb0350c | 5 | DigitalOut led1(LED1); |
| YCTung | 0:40477eb0350c | 6 | DigitalOut led2(D12); |
| YCTung | 0:40477eb0350c | 7 | DigitalOut led3(D11); |
| YCTung | 0:40477eb0350c | 8 | |
| YCTung | 0:40477eb0350c | 9 | Ticker timer1; |
| YCTung | 0:40477eb0350c | 10 | |
| YCTung | 0:40477eb0350c | 11 | void init_IO(void){ |
| YCTung | 0:40477eb0350c | 12 | led1 = 0; |
| YCTung | 0:40477eb0350c | 13 | led2 = 1; |
| YCTung | 0:40477eb0350c | 14 | led3 = 1; |
| YCTung | 0:40477eb0350c | 15 | } |
| YCTung | 0:40477eb0350c | 16 | |
| YCTung | 0:40477eb0350c | 17 | void timer1_interrupt(){ |
| YCTung | 0:40477eb0350c | 18 | ; |
| YCTung | 0:40477eb0350c | 19 | } |
| YCTung | 0:40477eb0350c | 20 | |
| YCTung | 0:40477eb0350c | 21 | void init_TIMER(void){ |
| YCTung | 0:40477eb0350c | 22 | timer1.attach_us(&timer1_interrupt, 1000.0);//1ms interrupt period (1 KHz) |
| YCTung | 0:40477eb0350c | 23 | } |
| YCTung | 0:40477eb0350c | 24 | |
| YCTung | 0:40477eb0350c | 25 | int main() { |
| YCTung | 0:40477eb0350c | 26 | |
| YCTung | 0:40477eb0350c | 27 | init_IO(); |
| YCTung | 0:40477eb0350c | 28 | init_TIMER(); |
| YCTung | 0:40477eb0350c | 29 | |
| YCTung | 0:40477eb0350c | 30 | while(1) { |
| YCTung | 0:40477eb0350c | 31 | ; |
| YCTung | 0:40477eb0350c | 32 | } |
| YCTung | 0:40477eb0350c | 33 | } |