Task 5.2.3
main.cpp@2:274f355265c9, 2019-09-20 (annotated)
- Committer:
- noutram
- Date:
- Fri Sep 20 13:33:01 2019 +0000
- Revision:
- 2:274f355265c9
- Parent:
- 0:437c844cec26
2019
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| noutram | 0:437c844cec26 | 1 | #include "mbed.h" |
| noutram | 0:437c844cec26 | 2 | |
| noutram | 2:274f355265c9 | 3 | DigitalOut OnBoardLed(LED1); |
| noutram | 2:274f355265c9 | 4 | |
| noutram | 2:274f355265c9 | 5 | #ifdef TARGET_NUCLEO_F429ZI |
| noutram | 2:274f355265c9 | 6 | PwmOut pwmRed(D6); //D7 is not a PWM output on the F429, so use D6 instead |
| noutram | 2:274f355265c9 | 7 | #else |
| noutram | 0:437c844cec26 | 8 | PwmOut pwmRed(D7); |
| noutram | 2:274f355265c9 | 9 | #endif |
| noutram | 0:437c844cec26 | 10 | |
| noutram | 0:437c844cec26 | 11 | int T = 10; |
| noutram | 2:274f355265c9 | 12 | int Tmark = 5; |
| noutram | 0:437c844cec26 | 13 | |
| noutram | 0:437c844cec26 | 14 | int main() { |
| noutram | 0:437c844cec26 | 15 | |
| noutram | 0:437c844cec26 | 16 | pwmRed.period_us(T); |
| noutram | 0:437c844cec26 | 17 | pwmRed.pulsewidth_us(Tmark); |
| noutram | 0:437c844cec26 | 18 | |
| noutram | 0:437c844cec26 | 19 | while(1) { |
| noutram | 2:274f355265c9 | 20 | //Heartbeat |
| noutram | 2:274f355265c9 | 21 | wait(1); |
| noutram | 2:274f355265c9 | 22 | OnBoardLed = !OnBoardLed; |
| noutram | 0:437c844cec26 | 23 | } |
| noutram | 0:437c844cec26 | 24 | } |