
hgfd
Dependencies: mbed
main.cpp@0:8ef14170e933, 2017-02-11 (annotated)
- Committer:
- ABuche
- Date:
- Sat Feb 11 16:04:59 2017 +0000
- Revision:
- 0:8ef14170e933
gb;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ABuche | 0:8ef14170e933 | 1 | #include "mbed.h" |
ABuche | 0:8ef14170e933 | 2 | |
ABuche | 0:8ef14170e933 | 3 | DigitalOut led1(LED1); |
ABuche | 0:8ef14170e933 | 4 | DigitalOut led2(LED1); |
ABuche | 0:8ef14170e933 | 5 | |
ABuche | 0:8ef14170e933 | 6 | DigitalOut reset(p8); |
ABuche | 0:8ef14170e933 | 7 | Serial UART(p13, p14); |
ABuche | 0:8ef14170e933 | 8 | |
ABuche | 0:8ef14170e933 | 9 | Serial pc(USBTX, USBRX); |
ABuche | 0:8ef14170e933 | 10 | |
ABuche | 0:8ef14170e933 | 11 | int main() { |
ABuche | 0:8ef14170e933 | 12 | reset = 0; |
ABuche | 0:8ef14170e933 | 13 | wait(0.4); |
ABuche | 0:8ef14170e933 | 14 | reset = 1; |
ABuche | 0:8ef14170e933 | 15 | |
ABuche | 0:8ef14170e933 | 16 | while(1) { |
ABuche | 0:8ef14170e933 | 17 | if (UART.readable()){ |
ABuche | 0:8ef14170e933 | 18 | char c = UART.getc(); |
ABuche | 0:8ef14170e933 | 19 | pc.putc(c); |
ABuche | 0:8ef14170e933 | 20 | } |
ABuche | 0:8ef14170e933 | 21 | |
ABuche | 0:8ef14170e933 | 22 | if(pc.readable()){ |
ABuche | 0:8ef14170e933 | 23 | char c = pc.getc(); |
ABuche | 0:8ef14170e933 | 24 | UART.putc(c); |
ABuche | 0:8ef14170e933 | 25 | } |
ABuche | 0:8ef14170e933 | 26 | } |
ABuche | 0:8ef14170e933 | 27 | } |