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.
USB/usb.cpp@0:77dba5d612e5, 2021-04-08 (annotated)
- Committer:
- jhusnik
- Date:
- Thu Apr 08 16:32:55 2021 +0000
- Revision:
- 0:77dba5d612e5
a
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jhusnik | 0:77dba5d612e5 | 1 | #include "usb.h" |
| jhusnik | 0:77dba5d612e5 | 2 | |
| jhusnik | 0:77dba5d612e5 | 3 | Serial PC(USBTX, USBRX, 9600); |
| jhusnik | 0:77dba5d612e5 | 4 | |
| jhusnik | 0:77dba5d612e5 | 5 | void Start(void){ |
| jhusnik | 0:77dba5d612e5 | 6 | PC.printf("\n\r Unos vrijednosti u rasponu 0 - 9:\n\r"); |
| jhusnik | 0:77dba5d612e5 | 7 | } |
| jhusnik | 0:77dba5d612e5 | 8 | |
| jhusnik | 0:77dba5d612e5 | 9 | float Unos(void){ |
| jhusnik | 0:77dba5d612e5 | 10 | char podatak = PC.getc(); |
| jhusnik | 0:77dba5d612e5 | 11 | PC.printf("%c\n\r", podatak); |
| jhusnik | 0:77dba5d612e5 | 12 | int a; |
| jhusnik | 0:77dba5d612e5 | 13 | float b; |
| jhusnik | 0:77dba5d612e5 | 14 | a = podatak; |
| jhusnik | 0:77dba5d612e5 | 15 | if ((a <= 57)&&(a >= 48 )){ |
| jhusnik | 0:77dba5d612e5 | 16 | b = (a - 48)/10.0; |
| jhusnik | 0:77dba5d612e5 | 17 | } |
| jhusnik | 0:77dba5d612e5 | 18 | return (b); |
| jhusnik | 0:77dba5d612e5 | 19 | } |