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.
Fork of PinDetect by
Diff: example.h
- Revision:
- 1:611a8f5ac65c
- Parent:
- 0:4f4ccb203a70
--- 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 );