Besa Mavriqi
/
Mbed_Polling
Beim Polling fragt man Signale regelmäßig innerhalb der Schleife ab und wertet diese Signale aus.
main.cpp@0:e0f6ebfbd2fe, 2020-01-27 (annotated)
- Committer:
- besam
- Date:
- Mon Jan 27 14:37:12 2020 +0000
- Revision:
- 0:e0f6ebfbd2fe
Letzte Version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
besam | 0:e0f6ebfbd2fe | 1 | #include "mbed.h" |
besam | 0:e0f6ebfbd2fe | 2 | |
besam | 0:e0f6ebfbd2fe | 3 | DigitalOut led1(LED1); |
besam | 0:e0f6ebfbd2fe | 4 | DigitalIn button(BUTTON1); |
besam | 0:e0f6ebfbd2fe | 5 | |
besam | 0:e0f6ebfbd2fe | 6 | int main() { |
besam | 0:e0f6ebfbd2fe | 7 | int zeit = 200; |
besam | 0:e0f6ebfbd2fe | 8 | while(1) { |
besam | 0:e0f6ebfbd2fe | 9 | led1 = 0; |
besam | 0:e0f6ebfbd2fe | 10 | wait_ms(zeit); |
besam | 0:e0f6ebfbd2fe | 11 | led1 = 1; |
besam | 0:e0f6ebfbd2fe | 12 | wait_ms(zeit); |
besam | 0:e0f6ebfbd2fe | 13 | if(button) { |
besam | 0:e0f6ebfbd2fe | 14 | zeit = 500; |
besam | 0:e0f6ebfbd2fe | 15 | } |
besam | 0:e0f6ebfbd2fe | 16 | } |
besam | 0:e0f6ebfbd2fe | 17 | } |