PinDectect Lib
Dependents: MusicPlayer_ThaoLeMinh MusicPlayer_ThaoLeMinh MusicPlayer_Thao_Yan_Melvin
Fork of PinDetect by
Diff: example.h
- Revision:
- 1:611a8f5ac65c
- Parent:
- 0:4f4ccb203a70
- Child:
- 3:f80b238f3de3
--- a/example.h Thu Jan 13 01:47:31 2011 +0000 +++ b/example.h Thu Jan 13 09:53:26 2011 +0000 @@ -25,12 +25,22 @@ #include "mbed.h" #include "PinDetect.h" -PinDetect pin( p21 ); +PinDetect pin ( p21 ); DigitalOut led1( LED1 ); DigitalOut led2( LED2 ); DigitalOut led3( LED3 ); DigitalOut led4( LED4 ); +/* + * Note, the PinDetect can be defined thus:- + * PinDetect pin( p21, PullDown ); + * This allows you to specify the DigitalIn pinmode + * when you create the PinDetect object. This means + * using pin.mode() later is then no longer required. + */ + +// C function callbacks follow. + void keyPressed( void ) { led2 = 1; led3 = 0; @@ -51,6 +61,8 @@ led4 = 1; } +// The main program. + int main() { pin.mode( PullDown );