Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
uart.h@1:c69f589b72b1, 2020-02-08 (annotated)
- Committer:
- efrstek
- Date:
- Sat Feb 08 16:14:23 2020 +0000
- Revision:
- 1:c69f589b72b1
uart
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
efrstek | 1:c69f589b72b1 | 1 | #include "mbed.h" |
efrstek | 1:c69f589b72b1 | 2 | Serial app(PA_2,PA_3); |
efrstek | 1:c69f589b72b1 | 3 | short ping; |
efrstek | 1:c69f589b72b1 | 4 | int t; |
efrstek | 1:c69f589b72b1 | 5 | void start() |
efrstek | 1:c69f589b72b1 | 6 | { |
efrstek | 1:c69f589b72b1 | 7 | char pin; |
efrstek | 1:c69f589b72b1 | 8 | pin=app.getc(); |
efrstek | 1:c69f589b72b1 | 9 | ping=pin; |
efrstek | 1:c69f589b72b1 | 10 | |
efrstek | 1:c69f589b72b1 | 11 | } |
efrstek | 1:c69f589b72b1 | 12 | int main() |
efrstek | 1:c69f589b72b1 | 13 | { |
efrstek | 1:c69f589b72b1 | 14 | app.baud(9600); |
efrstek | 1:c69f589b72b1 | 15 | app.attach(&start, Serial::RxIrq); |
efrstek | 1:c69f589b72b1 | 16 | while(1) { |
efrstek | 1:c69f589b72b1 | 17 | pc.printf("Primljeni podatak: %d\n",ping); |
efrstek | 1:c69f589b72b1 | 18 | if(ping==1) { |
efrstek | 1:c69f589b72b1 | 19 | //start program |
efrstek | 1:c69f589b72b1 | 20 | t=1; |
efrstek | 1:c69f589b72b1 | 21 | } |
efrstek | 1:c69f589b72b1 | 22 | if(ping==0) { |
efrstek | 1:c69f589b72b1 | 23 | //stop program |
efrstek | 1:c69f589b72b1 | 24 | t=0; |
efrstek | 1:c69f589b72b1 | 25 | } |
efrstek | 1:c69f589b72b1 | 26 | wait(1); |
efrstek | 1:c69f589b72b1 | 27 | } |
efrstek | 1:c69f589b72b1 | 28 | } |