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.
timed_switch.h@0:5d9b6304f982, 2012-02-11 (annotated)
- Committer:
- faif
- Date:
- Sat Feb 11 18:39:32 2012 +0000
- Revision:
- 0:5d9b6304f982
- Child:
- 1:a523eaac3b7c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
faif | 0:5d9b6304f982 | 1 | #ifndef TIMED_SWITCH_H |
faif | 0:5d9b6304f982 | 2 | #define TIMED_SWITCH_H |
faif | 0:5d9b6304f982 | 3 | |
faif | 0:5d9b6304f982 | 4 | enum {LedOff = 0, LedOn = 1}; |
faif | 0:5d9b6304f982 | 5 | enum {False, True}; |
faif | 0:5d9b6304f982 | 6 | |
faif | 0:5d9b6304f982 | 7 | const float wait_time = 0.2; // to avoid bouncing |
faif | 0:5d9b6304f982 | 8 | const float wait_on = 0.5; |
faif | 0:5d9b6304f982 | 9 | const float wait_off = 0.5; |
faif | 0:5d9b6304f982 | 10 | const unsigned short time_correction = wait_time * 1000; // correction in msec. |
faif | 0:5d9b6304f982 | 11 | |
faif | 0:5d9b6304f982 | 12 | Timer t; // for tracking time |
faif | 0:5d9b6304f982 | 13 | unsigned int button_holded; // for tracking how long was the button holded |
faif | 0:5d9b6304f982 | 14 | |
faif | 0:5d9b6304f982 | 15 | DigitalIn button (p19); |
faif | 0:5d9b6304f982 | 16 | DigitalOut myled (LED3); |
faif | 0:5d9b6304f982 | 17 | |
faif | 0:5d9b6304f982 | 18 | #endif |