Fianna Stenveld
/
Assignment_2
Assignement_2_c
Fork of Minor_test_serial by
main.cpp@3:d826445e3ce3, 2018-09-11 (annotated)
- Committer:
- Fianna
- Date:
- Tue Sep 11 13:49:42 2018 +0000
- Revision:
- 3:d826445e3ce3
- Parent:
- 2:161481e810dc
Now works perfectly!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsluiter | 0:c8f15874531b | 1 | #include "mbed.h" |
vsluiter | 0:c8f15874531b | 2 | #include "MODSERIAL.h" |
vsluiter | 0:c8f15874531b | 3 | |
vsluiter | 0:c8f15874531b | 4 | DigitalOut myled(LED_GREEN); |
vsluiter | 0:c8f15874531b | 5 | MODSERIAL pc(USBTX, USBRX); |
vsluiter | 0:c8f15874531b | 6 | |
vsluiter | 0:c8f15874531b | 7 | int main() |
vsluiter | 0:c8f15874531b | 8 | { |
vsluiter | 0:c8f15874531b | 9 | pc.baud(115200); |
Fianna | 2:161481e810dc | 10 | |
Fianna | 2:161481e810dc | 11 | |
Fianna | 2:161481e810dc | 12 | char c; |
Fianna | 2:161481e810dc | 13 | c = pc.getc(); |
Fianna | 2:161481e810dc | 14 | |
Fianna | 3:d826445e3ce3 | 15 | pc.printf("input user: %c\r\n", c); |
vsluiter | 0:c8f15874531b | 16 | |
vsluiter | 0:c8f15874531b | 17 | while (true) { |
Fianna | 2:161481e810dc | 18 | myled = !myled; |
Fianna | 2:161481e810dc | 19 | wait(0.3f); |
Fianna | 2:161481e810dc | 20 | |
vsluiter | 0:c8f15874531b | 21 | } |
vsluiter | 0:c8f15874531b | 22 | } |