Nothing

Dependencies:   mbed

Committer:
Jhp_pce
Date:
Mon Oct 21 13:15:37 2019 +0000
Revision:
0:4f766ef79761
nothing;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jhp_pce 0:4f766ef79761 1 #include "mbed.h"
Jhp_pce 0:4f766ef79761 2
Jhp_pce 0:4f766ef79761 3 InterruptIn button(USER_BUTTON);
Jhp_pce 0:4f766ef79761 4
Jhp_pce 0:4f766ef79761 5 DigitalOut led(LED1);
Jhp_pce 0:4f766ef79761 6
Jhp_pce 0:4f766ef79761 7 double delay = 0.5; // 500 ms
Jhp_pce 0:4f766ef79761 8
Jhp_pce 0:4f766ef79761 9 void pressed()
Jhp_pce 0:4f766ef79761 10 {
Jhp_pce 0:4f766ef79761 11 delay = 0.1; // 100 ms
Jhp_pce 0:4f766ef79761 12 }
Jhp_pce 0:4f766ef79761 13
Jhp_pce 0:4f766ef79761 14 void released()
Jhp_pce 0:4f766ef79761 15 {
Jhp_pce 0:4f766ef79761 16 delay = 0.5; // 500 ms
Jhp_pce 0:4f766ef79761 17 }
Jhp_pce 0:4f766ef79761 18
Jhp_pce 0:4f766ef79761 19 int main()
Jhp_pce 0:4f766ef79761 20 {
Jhp_pce 0:4f766ef79761 21 // Assign functions to button
Jhp_pce 0:4f766ef79761 22 button.fall(&pressed);
Jhp_pce 0:4f766ef79761 23 button.rise(&released);
Jhp_pce 0:4f766ef79761 24
Jhp_pce 0:4f766ef79761 25 while (1) {
Jhp_pce 0:4f766ef79761 26 led = !led;
Jhp_pce 0:4f766ef79761 27 wait(delay);
Jhp_pce 0:4f766ef79761 28 }
Jhp_pce 0:4f766ef79761 29 }