![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
hello world
Fork of DigitalOut_HelloWorld by
main.cpp@9:06a64cd24c6e, 2017-06-23 (annotated)
- Committer:
- sarahmarshy
- Date:
- Fri Jun 23 13:39:18 2017 -0500
- Revision:
- 9:06a64cd24c6e
- Parent:
- 7:21a83a7b8f94
Update mbed-os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 4:340f9fb00d71 | 1 | /* mbed Example Program |
mbedAustin | 4:340f9fb00d71 | 2 | * Copyright (c) 2006-2014 ARM Limited |
mbedAustin | 4:340f9fb00d71 | 3 | * |
mbedAustin | 4:340f9fb00d71 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbedAustin | 4:340f9fb00d71 | 5 | * you may not use this file except in compliance with the License. |
mbedAustin | 4:340f9fb00d71 | 6 | * You may obtain a copy of the License at |
mbedAustin | 4:340f9fb00d71 | 7 | * |
mbedAustin | 4:340f9fb00d71 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbedAustin | 4:340f9fb00d71 | 9 | * |
mbedAustin | 4:340f9fb00d71 | 10 | * Unless required by applicable law or agreed to in writing, software |
mbedAustin | 4:340f9fb00d71 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbedAustin | 4:340f9fb00d71 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbedAustin | 4:340f9fb00d71 | 13 | * See the License for the specific language governing permissions and |
mbedAustin | 4:340f9fb00d71 | 14 | * limitations under the License. |
mbedAustin | 4:340f9fb00d71 | 15 | */ |
mbed_official | 0:b5a9e0614efd | 16 | #include "mbed.h" |
mbed_official | 0:b5a9e0614efd | 17 | |
mbed_official | 0:b5a9e0614efd | 18 | DigitalOut myled(LED1); |
mbed_official | 0:b5a9e0614efd | 19 | |
mbedAustin | 7:21a83a7b8f94 | 20 | int main() |
mbedAustin | 7:21a83a7b8f94 | 21 | { |
mbedAustin | 6:4b14e87b65e9 | 22 | // check that myled object is initialized and connected to a pin |
mbedAustin | 7:21a83a7b8f94 | 23 | if(myled.is_connected()) { |
mbedAustin | 6:4b14e87b65e9 | 24 | printf("myled is initialized and connected!\n\r"); |
mbedAustin | 5:e17647bbb68e | 25 | } |
mbedAustin | 7:21a83a7b8f94 | 26 | |
mbedAustin | 6:4b14e87b65e9 | 27 | // Blink LED |
mbed_official | 0:b5a9e0614efd | 28 | while(1) { |
mbedAustin | 3:29debdbea629 | 29 | myled = 1; // set LED1 pin to high |
mbedAustin | 7:21a83a7b8f94 | 30 | printf("\n\r myled = %d", (uint8_t)myled ); |
mbedAustin | 3:29debdbea629 | 31 | wait(0.5); |
mbedAustin | 7:21a83a7b8f94 | 32 | |
mbedAustin | 3:29debdbea629 | 33 | myled.write(0); // set LED1 pin to low |
mbedAustin | 3:29debdbea629 | 34 | printf("\n\r myled = %d",myled.read() ); |
mbedAustin | 3:29debdbea629 | 35 | wait(0.5); |
mbed_official | 0:b5a9e0614efd | 36 | } |
mbed_official | 0:b5a9e0614efd | 37 | } |