![](/media/cache/group/mbed-logo-square-512_3.png.50x50_q85.png)
RawSerial Helloworld example
Fork of RawSerial_ex_1 by
main.cpp@1:f21d95cb733d, 2017-10-10 (annotated)
- Committer:
- kgilbert
- Date:
- Tue Oct 10 19:04:22 2017 +0000
- Revision:
- 1:f21d95cb733d
- Parent:
- 0:c68431f372b4
Add source for example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kgilbert | 1:f21d95cb733d | 1 | /* mbed Example Program |
kgilbert | 1:f21d95cb733d | 2 | * Copyright (c) 2006-2014 ARM Limited |
kgilbert | 1:f21d95cb733d | 3 | * |
kgilbert | 1:f21d95cb733d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kgilbert | 1:f21d95cb733d | 5 | * you may not use this file except in compliance with the License. |
kgilbert | 1:f21d95cb733d | 6 | * You may obtain a copy of the License at |
kgilbert | 1:f21d95cb733d | 7 | * |
kgilbert | 1:f21d95cb733d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kgilbert | 1:f21d95cb733d | 9 | * |
kgilbert | 1:f21d95cb733d | 10 | * Unless required by applicable law or agreed to in writing, software |
kgilbert | 1:f21d95cb733d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kgilbert | 1:f21d95cb733d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kgilbert | 1:f21d95cb733d | 13 | * See the License for the specific language governing permissions and |
kgilbert | 1:f21d95cb733d | 14 | * limitations under the License. |
kgilbert | 1:f21d95cb733d | 15 | */ |
kgilbert | 0:c68431f372b4 | 16 | #include "mbed.h" |
kgilbert | 0:c68431f372b4 | 17 | |
kgilbert | 1:f21d95cb733d | 18 | RawSerial pc(USBTX, USBRX); // tx, rx |
kgilbert | 0:c68431f372b4 | 19 | |
kgilbert | 0:c68431f372b4 | 20 | int main() { |
kgilbert | 1:f21d95cb733d | 21 | pc.printf("Hello World!\n\r"); |
kgilbert | 1:f21d95cb733d | 22 | while(1) { |
kgilbert | 1:f21d95cb733d | 23 | pc.putc(pc.getc()); // echo input back to terminal |
kgilbert | 1:f21d95cb733d | 24 | } |
kgilbert | 0:c68431f372b4 | 25 | } |