Serial Hello World

Fork of Serial_HelloWorld_Mbed by Mbed

Note

For simple debug statements over the USB UART channel you can just call printf and it will be automatically redirected to the terminal over USB.

API

API summary

Import librarymbed

No documentation found.
Committer:
sarahmarshy
Date:
Fri Jun 23 17:47:51 2017 -0500
Revision:
4:18e08b8afd16
Parent:
2:033eefd2904e
"Update mbed-os"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 2:033eefd2904e 1 /* mbed Example Program
mbedAustin 2:033eefd2904e 2 * Copyright (c) 2006-2014 ARM Limited
mbedAustin 2:033eefd2904e 3 *
mbedAustin 2:033eefd2904e 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbedAustin 2:033eefd2904e 5 * you may not use this file except in compliance with the License.
mbedAustin 2:033eefd2904e 6 * You may obtain a copy of the License at
mbedAustin 2:033eefd2904e 7 *
mbedAustin 2:033eefd2904e 8 * http://www.apache.org/licenses/LICENSE-2.0
mbedAustin 2:033eefd2904e 9 *
mbedAustin 2:033eefd2904e 10 * Unless required by applicable law or agreed to in writing, software
mbedAustin 2:033eefd2904e 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbedAustin 2:033eefd2904e 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbedAustin 2:033eefd2904e 13 * See the License for the specific language governing permissions and
mbedAustin 2:033eefd2904e 14 * limitations under the License.
mbedAustin 2:033eefd2904e 15 */
mbed_official 0:879aa9d0247b 16 #include "mbed.h"
mbed_official 0:879aa9d0247b 17
mbed_official 0:879aa9d0247b 18 Serial pc(USBTX, USBRX); // tx, rx
mbed_official 0:879aa9d0247b 19
mbed_official 0:879aa9d0247b 20 int main() {
mbedAustin 1:560b8ced44df 21 pc.printf("Hello World!\n\r");
mbed_official 0:879aa9d0247b 22 while(1) {
mbedAustin 1:560b8ced44df 23 pc.putc(pc.getc() + 1); // echo input back to terminal
mbed_official 0:879aa9d0247b 24 }
mbed_official 0:879aa9d0247b 25 }