Of course Andy ... The programme core is the following:
- include "mbed.h"
- include "PinDetect.h"
PinDetect pin (p5);
PinDetect pin_2 (p10);
DigitalOut led1( LED1 );
DigitalOut led2( LED2 );
DigitalOut led3( LED3 );
void keyPressed( void ) {
led2 = 1;
Stop();
}
void keyReleased( void ) {
led2 = 0;
}
void keyPressed_2( void ) {
led3 = 1;
Stop();
}
void keyReleased_2( void ) {
led3 = 0;
}
int main() {
pin.mode( PullDown );
pin.attach_asserted( &keyPressed );
pin.attach_deasserted( &keyReleased );
pin.setSampleFrequency(); Defaults to 20ms.
pin.mode( PullDown );
pin.attach_asserted( &keyPressed_2 );
pin.attach_deasserted( &keyReleased_2 );
pin.setSampleFrequency(); Defaults to 20ms.
while( 1 ) {
led1 = !led1;
mean_S1 = 3.3*Sensor_3.read();
wait( 0.2 );
}
}
Dear all ...
I´m working in a security system for a machine. I need to use two buttoms which can stop the device as soon as posible, independently of the process in progress. I´ve been working with the "PinDetect" library (http://mbed.org/users/AjK/libraries/PinDetect/lkyxpw) succesfully but only with one buttom. Can the proper instructions be used simultaneosly with other buttom connected in other pin?? How could this be done??
Thank you very much in advance.
PD: Anyway, really nice work with this library.