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.
main.cpp@8:18d4824c5a92, 2020-02-18 (annotated)
- Committer:
- aronbrun
- Date:
- Tue Feb 18 15:10:07 2020 +0000
- Revision:
- 8:18d4824c5a92
- Parent:
- 7:179e4f3a0c12
second;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| marcel1691 | 0:3ec5cf718e17 | 1 | /** Mittels DigitalOut kann eine Positive Spannung an einem Pin erzeugt werden. |
| marcel1691 | 0:3ec5cf718e17 | 2 | */ |
| marcel1691 | 0:3ec5cf718e17 | 3 | #include "mbed.h" |
| marcel1691 | 0:3ec5cf718e17 | 4 | |
| marcel1691 | 5:522c5a0a51d3 | 5 | DigitalOut led1( MBED_CONF_IOTKIT_LED1 ); |
| marcel1691 | 5:522c5a0a51d3 | 6 | DigitalOut led2( MBED_CONF_IOTKIT_LED2 ); |
| marcel1691 | 5:522c5a0a51d3 | 7 | DigitalOut led3( MBED_CONF_IOTKIT_LED3 ); |
| marcel1691 | 5:522c5a0a51d3 | 8 | DigitalOut led4( MBED_CONF_IOTKIT_LED4 ); |
| marcel1691 | 0:3ec5cf718e17 | 9 | |
| marcel1691 | 3:a3bb30844cb5 | 10 | // optimiert float statt double wenn ohne "f" |
| aronbrun | 8:18d4824c5a92 | 11 | float warte = 1.5f; |
| marcel1691 | 3:a3bb30844cb5 | 12 | |
| marcel1691 | 0:3ec5cf718e17 | 13 | int main() |
| marcel1691 | 0:3ec5cf718e17 | 14 | { |
| marcel1691 | 0:3ec5cf718e17 | 15 | while(1) |
| marcel1691 | 0:3ec5cf718e17 | 16 | { |
| marcel1691 | 3:a3bb30844cb5 | 17 | // kurze Schreibweise, operator= ist ueberschrieben |
| marcel1691 | 3:a3bb30844cb5 | 18 | led1 = 1; |
| marcel1691 | 3:a3bb30844cb5 | 19 | led2 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 20 | led3 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 21 | led4 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 22 | wait( warte ); |
| marcel1691 | 0:3ec5cf718e17 | 23 | |
| marcel1691 | 3:a3bb30844cb5 | 24 | // Aufruf der Methode |
| marcel1691 | 3:a3bb30844cb5 | 25 | led1.write( 0 ); |
| marcel1691 | 3:a3bb30844cb5 | 26 | led2.write( 1 ); |
| marcel1691 | 2:8d82070d631e | 27 | led3.write( 0 ); |
| marcel1691 | 2:8d82070d631e | 28 | led4.write( 0 ); |
| marcel1691 | 3:a3bb30844cb5 | 29 | wait( warte ); |
| marcel1691 | 3:a3bb30844cb5 | 30 | |
| marcel1691 | 3:a3bb30844cb5 | 31 | led1 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 32 | led2 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 33 | led3 = 1; |
| marcel1691 | 3:a3bb30844cb5 | 34 | led4 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 35 | wait( warte ); |
| marcel1691 | 3:a3bb30844cb5 | 36 | |
| marcel1691 | 3:a3bb30844cb5 | 37 | led1 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 38 | led2 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 39 | led3 = 0; |
| marcel1691 | 3:a3bb30844cb5 | 40 | led4 = 1; |
| marcel1691 | 3:a3bb30844cb5 | 41 | wait( warte ); |
| marcel1691 | 3:a3bb30844cb5 | 42 | |
| marcel1691 | 0:3ec5cf718e17 | 43 | } |
| marcel1691 | 0:3ec5cf718e17 | 44 | } |