![](/media/cache/profiles/9ddc70b3617c3e65c03fa63c230a1705.50x50_q85.jpg)
LED1 mit 2 Tastern ein und aus schalten
main.cpp@0:a7fedb08e90d, 2011-06-25 (annotated)
- Committer:
- wango
- Date:
- Sat Jun 25 11:34:51 2011 +0000
- Revision:
- 0:a7fedb08e90d
FET10
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wango | 0:a7fedb08e90d | 1 | #include "mbed.h" |
wango | 0:a7fedb08e90d | 2 | |
wango | 0:a7fedb08e90d | 3 | DigitalIn Taster(p20); // Deklaration des tasters auf pin 10 |
wango | 0:a7fedb08e90d | 4 | DigitalIn taster2(p19); |
wango | 0:a7fedb08e90d | 5 | |
wango | 0:a7fedb08e90d | 6 | DigitalOut LED (LED1); |
wango | 0:a7fedb08e90d | 7 | Serial pc(USBTX, USBRX); // Serielle Schnittstelle |
wango | 0:a7fedb08e90d | 8 | |
wango | 0:a7fedb08e90d | 9 | int main() |
wango | 0:a7fedb08e90d | 10 | { |
wango | 0:a7fedb08e90d | 11 | while(1) |
wango | 0:a7fedb08e90d | 12 | { |
wango | 0:a7fedb08e90d | 13 | if (Taster) // wenn Taster = 1 dann |
wango | 0:a7fedb08e90d | 14 | { |
wango | 0:a7fedb08e90d | 15 | |
wango | 0:a7fedb08e90d | 16 | LED = 1; // Hallo Welt |
wango | 0:a7fedb08e90d | 17 | wait_ms(1); // Warte 1 Sekunde und wenn dann immer noch p10 = 1 ist, dann schreibe wieder Hallo Welt |
wango | 0:a7fedb08e90d | 18 | |
wango | 0:a7fedb08e90d | 19 | } |
wango | 0:a7fedb08e90d | 20 | if (taster2) |
wango | 0:a7fedb08e90d | 21 | { |
wango | 0:a7fedb08e90d | 22 | |
wango | 0:a7fedb08e90d | 23 | LED = 0; |
wango | 0:a7fedb08e90d | 24 | wait_ms(1); |
wango | 0:a7fedb08e90d | 25 | } |
wango | 0:a7fedb08e90d | 26 | } |
wango | 0:a7fedb08e90d | 27 | } |