PortOut Hello World

Dependencies:   mbed

Fork of PortOut_HelloWorld by Mbed

Note

Depending on your board your ports may be named as numbers or as letters. For example the NXP boards have Port1, Port2, Port3...etc but the Freescale boards have PortA, PortB, PortC, PortD. Please refer to the boards Platform page to find out which one your board uses.

API

API reference.

Import librarymbed

No documentation found.
Committer:
mbedAustin
Date:
Fri Mar 27 20:15:31 2015 +0000
Revision:
2:e4e6fab14d21
Parent:
0:9bbfdb1487ff
Added license to main.c file.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 2:e4e6fab14d21 1 /* mbed Example Program
mbedAustin 2:e4e6fab14d21 2 * Copyright (c) 2006-2014 ARM Limited
mbedAustin 2:e4e6fab14d21 3 *
mbedAustin 2:e4e6fab14d21 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbedAustin 2:e4e6fab14d21 5 * you may not use this file except in compliance with the License.
mbedAustin 2:e4e6fab14d21 6 * You may obtain a copy of the License at
mbedAustin 2:e4e6fab14d21 7 *
mbedAustin 2:e4e6fab14d21 8 * http://www.apache.org/licenses/LICENSE-2.0
mbedAustin 2:e4e6fab14d21 9 *
mbedAustin 2:e4e6fab14d21 10 * Unless required by applicable law or agreed to in writing, software
mbedAustin 2:e4e6fab14d21 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbedAustin 2:e4e6fab14d21 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbedAustin 2:e4e6fab14d21 13 * See the License for the specific language governing permissions and
mbedAustin 2:e4e6fab14d21 14 * limitations under the License.
mbedAustin 2:e4e6fab14d21 15 */
mbedAustin 2:e4e6fab14d21 16
mbedAustin 2:e4e6fab14d21 17
mbed_official 0:9bbfdb1487ff 18 // Toggle all four LEDs
mbed_official 0:9bbfdb1487ff 19
mbed_official 0:9bbfdb1487ff 20 #include "mbed.h"
mbed_official 0:9bbfdb1487ff 21
mbed_official 0:9bbfdb1487ff 22 // LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23
mbed_official 0:9bbfdb1487ff 23 #define LED_MASK 0x00B40000
mbed_official 0:9bbfdb1487ff 24
mbed_official 0:9bbfdb1487ff 25 PortOut ledport(Port1, LED_MASK);
mbed_official 0:9bbfdb1487ff 26
mbed_official 0:9bbfdb1487ff 27 int main() {
mbed_official 0:9bbfdb1487ff 28 while(1) {
mbed_official 0:9bbfdb1487ff 29 ledport = LED_MASK;
mbed_official 0:9bbfdb1487ff 30 wait(1);
mbed_official 0:9bbfdb1487ff 31 ledport = 0;
mbed_official 0:9bbfdb1487ff 32 wait(1);
mbed_official 0:9bbfdb1487ff 33 }
mbed_official 0:9bbfdb1487ff 34 }