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.
Dependencies: mbed
main.cpp@1:fc8fd0a0c09d, 2019-02-12 (annotated)
- Committer:
- Danyal
- Date:
- Tue Feb 12 12:24:54 2019 +0000
- Revision:
- 1:fc8fd0a0c09d
- Parent:
- 0:3a42b53185b8
schlechte Sternchenausgabe
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Danyal | 1:fc8fd0a0c09d | 1 | /** |
| Danyal | 1:fc8fd0a0c09d | 2 | Ausgabe der Spannung in Sternen |
| Danyal | 1:fc8fd0a0c09d | 3 | */ |
| Danyal | 1:fc8fd0a0c09d | 4 | |
| Danyal | 0:3a42b53185b8 | 5 | #include "mbed.h" |
| Danyal | 0:3a42b53185b8 | 6 | |
| Danyal | 0:3a42b53185b8 | 7 | AnalogIn input(A0); |
| Danyal | 0:3a42b53185b8 | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
| Danyal | 0:3a42b53185b8 | 9 | |
| Danyal | 0:3a42b53185b8 | 10 | int main() { |
| Danyal | 0:3a42b53185b8 | 11 | |
| Danyal | 0:3a42b53185b8 | 12 | |
| Danyal | 0:3a42b53185b8 | 13 | uint16_t inputWert = 0x0000; |
| Danyal | 0:3a42b53185b8 | 14 | |
| Danyal | 0:3a42b53185b8 | 15 | |
| Danyal | 0:3a42b53185b8 | 16 | while (1) { |
| Danyal | 0:3a42b53185b8 | 17 | |
| Danyal | 0:3a42b53185b8 | 18 | inputWert = input.read_u16(); |
| Danyal | 0:3a42b53185b8 | 19 | pc.printf("sample value: 0x%04X\n",inputWert); |
| Danyal | 0:3a42b53185b8 | 20 | |
| Danyal | 0:3a42b53185b8 | 21 | wait_ms(10); |
| Danyal | 0:3a42b53185b8 | 22 | |
| Danyal | 0:3a42b53185b8 | 23 | pc.printf("Spannung\n"); |
| Danyal | 0:3a42b53185b8 | 24 | if(inputWert != 0x0000) { |
| Danyal | 0:3a42b53185b8 | 25 | if (inputWert <= 0x5555){ |
| Danyal | 0:3a42b53185b8 | 26 | pc.printf("<***** >\n");} |
| Danyal | 0:3a42b53185b8 | 27 | if(inputWert >= 0x5555 && inputWert <= 0xAAAA){ |
| Danyal | 0:3a42b53185b8 | 28 | pc.printf("<***** ***** >\n");} |
| Danyal | 0:3a42b53185b8 | 29 | if(inputWert >= 0xAAAA){ |
| Danyal | 0:3a42b53185b8 | 30 | pc.printf("<***** ***** *****>\n");} |
| Danyal | 0:3a42b53185b8 | 31 | } else { |
| Danyal | 0:3a42b53185b8 | 32 | pc.printf("< >\n");} |
| Danyal | 0:3a42b53185b8 | 33 | pc.printf("\n"); |
| Danyal | 0:3a42b53185b8 | 34 | } |
| Danyal | 0:3a42b53185b8 | 35 | } |