Laboratoire APP3
Dependencies: mbed
main.cpp@1:333619c7ac99, 2017-02-09 (annotated)
- Committer:
- benjaminroy
- Date:
- Thu Feb 09 16:20:28 2017 +0000
- Revision:
- 1:333619c7ac99
- Parent:
- 0:638b592ccbf5
Laboratoire termin?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benjaminroy | 0:638b592ccbf5 | 1 | #include "mbed.h" |
benjaminroy | 0:638b592ccbf5 | 2 | |
benjaminroy | 1:333619c7ac99 | 3 | DigitalOut dout(p8); |
benjaminroy | 0:638b592ccbf5 | 4 | |
benjaminroy | 1:333619c7ac99 | 5 | Serial pc(USBTX, USBRX); // tx, rx |
benjaminroy | 1:333619c7ac99 | 6 | Serial uart(p13, p14); // tx, rx |
benjaminroy | 1:333619c7ac99 | 7 | |
benjaminroy | 0:638b592ccbf5 | 8 | int main() { |
benjaminroy | 1:333619c7ac99 | 9 | dout = 0; |
benjaminroy | 1:333619c7ac99 | 10 | wait(0.4); |
benjaminroy | 1:333619c7ac99 | 11 | dout = 1; |
benjaminroy | 1:333619c7ac99 | 12 | |
benjaminroy | 0:638b592ccbf5 | 13 | while(1) { |
benjaminroy | 1:333619c7ac99 | 14 | if(pc.readable()) { |
benjaminroy | 1:333619c7ac99 | 15 | uart.putc(pc.getc()); |
benjaminroy | 1:333619c7ac99 | 16 | } |
benjaminroy | 1:333619c7ac99 | 17 | if(uart.readable()) { |
benjaminroy | 1:333619c7ac99 | 18 | pc.putc(uart.getc()); |
benjaminroy | 1:333619c7ac99 | 19 | } |
benjaminroy | 0:638b592ccbf5 | 20 | } |
benjaminroy | 1:333619c7ac99 | 21 | } |