Marcelo Sforza
Forum Replies Created
-
AuthorPosts
-
Marcelo Sforza
ParticipantHi.
many thanks for the support, i find the solution using the comments of these link : https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/io/InterruptIn/Thanks again !.
MarceloMarcelo Sforza
ParticipantHi. More detail info of code:
//Sensor PIR – Security system
InterruptIn IO1(PA_0); // xDot:pin 34 – PCB: i1 Conector P1-2
InterruptIn IO2(PB_12); // xDot:pin 9 – PCB: i2 Conector P1-3
InterruptIn IO3(PB_13); // xDot:pin 10 – PCB: i3 Conector P1-4
InterruptIn IO4(PB_15); // xDot:pin 11 – PCB: i4 Conector P1-5
InterruptIn IO5(PB_14); // xDot:pin 12 – PCB: i5 Conector P1-6/*
…..
*/void rise1() {
pc.printf(“IO1=Sensor PIR detect RISE !\r\n”); // Turn on led1 +led2
led1 = 1;
mon_cpu_pcb();
in_int=1; // Interrup arrived to PIN:P1-1
counter_1++;
wait (0.1);
led1=0;}
void fall1() {
pc.printf(“IO1=Sensor PIR detect FALL !\r\n”); // Turn on led1 +led2
pc.printf(“IO5 -> Nr Pulse read:%d\r\n”, counter_1);}
/*
….
*/int main()
{
.
.
.IO1.mode(PullUp); // (PullUp) – (PullDown)
IO2.mode(PullUp);
IO3.mode(PullUp);
IO4.mode(PullUp);
IO5.mode(PullUp);IO1.rise(&rise1); // attach the address of the rise function to the rising edge
IO2.rise(&rise2); // attach the address of the rise function to the rising edge
IO3.rise(&rise3); // attach the address of the rise function to the rising edge
IO4.rise(&rise4); // attach the address of the rise function to the rising edge
IO5.rise(&rise5); // attach the address of the rise function to the rising edgeIO1.fall(&fall1); // attach the address of the rise function to the rising edge
IO1.fall(&fall2); // attach the address of the rise function to the rising edge
IO1.fall(&fall3); // attach the address of the rise function to the rising edge
IO1.fall(&fall4); // attach the address of the rise function to the rising edge
IO1.fall(&fall5); // attach the address of the rise function to the rising edgewhile(1){
-
AuthorPosts