communication for safety project
Dependencies: mbed
main.cpp@0:8fcca12e22fe, 2017-11-21 (annotated)
- Committer:
- Asimtaj
- Date:
- Tue Nov 21 18:59:54 2017 +0000
- Revision:
- 0:8fcca12e22fe
communication for master controller
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Asimtaj | 0:8fcca12e22fe | 1 | #include "mbed.h" |
Asimtaj | 0:8fcca12e22fe | 2 | Serial pc(USBTX, USBRX); |
Asimtaj | 0:8fcca12e22fe | 3 | Serial uart(p28, p27); |
Asimtaj | 0:8fcca12e22fe | 4 | |
Asimtaj | 0:8fcca12e22fe | 5 | int count = 50; |
Asimtaj | 0:8fcca12e22fe | 6 | |
Asimtaj | 0:8fcca12e22fe | 7 | int main() { |
Asimtaj | 0:8fcca12e22fe | 8 | pc.printf("%d",count); |
Asimtaj | 0:8fcca12e22fe | 9 | while (1) { |
Asimtaj | 0:8fcca12e22fe | 10 | |
Asimtaj | 0:8fcca12e22fe | 11 | char str[125]=""; |
Asimtaj | 0:8fcca12e22fe | 12 | sprintf(str, "%d", count); |
Asimtaj | 0:8fcca12e22fe | 13 | if(uart.writeable()) |
Asimtaj | 0:8fcca12e22fe | 14 | { |
Asimtaj | 0:8fcca12e22fe | 15 | uart.printf("%s\n",str); |
Asimtaj | 0:8fcca12e22fe | 16 | } |
Asimtaj | 0:8fcca12e22fe | 17 | |
Asimtaj | 0:8fcca12e22fe | 18 | } |
Asimtaj | 0:8fcca12e22fe | 19 | } |