Lucas Neves
/
Minor_test_serial
Hello!
Fork of Minor_test_serial by
main.cpp@2:add4f29be23e, 2018-09-11 (annotated)
- Committer:
- sacul276
- Date:
- Tue Sep 11 14:38:40 2018 +0000
- Revision:
- 2:add4f29be23e
- Parent:
- 1:40470bc517f1
Hello!
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 | |
sacul276 | 2:add4f29be23e | 4 | DigitalOut myled(LED_GREEN); //[Information flow] Out: Board -> PC ; IN: PC -> Board |
sacul276 | 2:add4f29be23e | 5 | MODSERIAL pc(USBTX, USBRX); //Needed to use a screen --> PuTTY |
vsluiter | 0:c8f15874531b | 6 | |
vsluiter | 0:c8f15874531b | 7 | int main() |
vsluiter | 0:c8f15874531b | 8 | { |
vsluiter | 0:c8f15874531b | 9 | int i = 0; |
vsluiter | 0:c8f15874531b | 10 | pc.baud(115200); |
Gijsvanoort | 1:40470bc517f1 | 11 | pc.printf("Hello World!\r\n"); |
sacul276 | 2:add4f29be23e | 12 | |
sacul276 | 2:add4f29be23e | 13 | char c; |
sacul276 | 2:add4f29be23e | 14 | |
vsluiter | 0:c8f15874531b | 15 | |
vsluiter | 0:c8f15874531b | 16 | while (true) { |
vsluiter | 0:c8f15874531b | 17 | wait(0.5f); // wait a small period of time |
Gijsvanoort | 1:40470bc517f1 | 18 | pc.printf("%d \r\n", i); // print the value of variable i |
vsluiter | 0:c8f15874531b | 19 | i++; // increment the variable |
vsluiter | 0:c8f15874531b | 20 | myled = !myled; // toggle a led |
sacul276 | 2:add4f29be23e | 21 | c = pc.getc(); |
vsluiter | 0:c8f15874531b | 22 | } |
vsluiter | 0:c8f15874531b | 23 | } |