Mbed Colombia Meetup
/
MBC001-DigitalOut
MBC001 - DigitalOut This example use the DigitalOut function
main.cpp@0:54f0e2724f0e, 2018-05-14 (annotated)
- Committer:
- leandropg
- Date:
- Mon May 14 15:14:15 2018 +0000
- Revision:
- 0:54f0e2724f0e
MBC001 - DigitalOut; This example use the DigitalOut function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leandropg | 0:54f0e2724f0e | 1 | /** |
leandropg | 0:54f0e2724f0e | 2 | * MBC001 - DigitalOut |
leandropg | 0:54f0e2724f0e | 3 | * This example use the DigitalOut function |
leandropg | 0:54f0e2724f0e | 4 | * 14 May 2018 - Mbed Colombia - http://mbedcolombia.wordpress.com/ |
leandropg | 0:54f0e2724f0e | 5 | * |
leandropg | 0:54f0e2724f0e | 6 | * Board: ST-Nucleo-F446RE - https://os.mbed.com/platforms/ST-Nucleo-F446RE/ |
leandropg | 0:54f0e2724f0e | 7 | * |
leandropg | 0:54f0e2724f0e | 8 | * Copyright [2018] [Leandro Perez Guatibonza / leandropg AT gmail DOT com] |
leandropg | 0:54f0e2724f0e | 9 | * |
leandropg | 0:54f0e2724f0e | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
leandropg | 0:54f0e2724f0e | 11 | * you may not use this file except in compliance with the License. |
leandropg | 0:54f0e2724f0e | 12 | * You may obtain a copy of the License at |
leandropg | 0:54f0e2724f0e | 13 | * |
leandropg | 0:54f0e2724f0e | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
leandropg | 0:54f0e2724f0e | 15 | * |
leandropg | 0:54f0e2724f0e | 16 | * Unless required by applicable law or agreed to in writing, software |
leandropg | 0:54f0e2724f0e | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
leandropg | 0:54f0e2724f0e | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
leandropg | 0:54f0e2724f0e | 19 | * See the License for the specific language governing permissions and |
leandropg | 0:54f0e2724f0e | 20 | * limitations under the License. |
leandropg | 0:54f0e2724f0e | 21 | */ |
leandropg | 0:54f0e2724f0e | 22 | #include "mbed.h" |
leandropg | 0:54f0e2724f0e | 23 | |
leandropg | 0:54f0e2724f0e | 24 | // LED connected Pin PC_0 |
leandropg | 0:54f0e2724f0e | 25 | DigitalOut led(PC_0); |
leandropg | 0:54f0e2724f0e | 26 | |
leandropg | 0:54f0e2724f0e | 27 | // Main Loop runs in its own thread in the OS |
leandropg | 0:54f0e2724f0e | 28 | int main() { |
leandropg | 0:54f0e2724f0e | 29 | |
leandropg | 0:54f0e2724f0e | 30 | // Inifite Loop |
leandropg | 0:54f0e2724f0e | 31 | while(1) { |
leandropg | 0:54f0e2724f0e | 32 | |
leandropg | 0:54f0e2724f0e | 33 | // LED Turn-On |
leandropg | 0:54f0e2724f0e | 34 | led = 1; |
leandropg | 0:54f0e2724f0e | 35 | |
leandropg | 0:54f0e2724f0e | 36 | // Wait 200 ms |
leandropg | 0:54f0e2724f0e | 37 | wait(0.2); |
leandropg | 0:54f0e2724f0e | 38 | |
leandropg | 0:54f0e2724f0e | 39 | // LED Turn-Off |
leandropg | 0:54f0e2724f0e | 40 | led = 0; |
leandropg | 0:54f0e2724f0e | 41 | |
leandropg | 0:54f0e2724f0e | 42 | // Wait 200 ms |
leandropg | 0:54f0e2724f0e | 43 | wait(0.2); |
leandropg | 0:54f0e2724f0e | 44 | } |
leandropg | 0:54f0e2724f0e | 45 | } |