Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
when the code executes p19 is receiving a low signal. it should wait till a high is sent to p19 and execute the interrupt function 'trigger'. however it won't enter the wait state and i receive the error:
*** assertion failed: base == LPC_GPIO0_BASE || base == LPC_GPIO2_BASE, file src/InterruptIn.cpp, line 41
the low signal is coming from an inverter.. connected to a tsop1236. an oscilloscope confirms that the inverting is provind p19 with a low signal. my code is simple in order to confirm that i understand how an interrupt works. also, as soon as the error message appears in terminal on my pc, the loop L1 = ~L1; does not execute
any help in figuring out why i'm getting an error would be appreciated. thank you.
#include "mbed.h"
InterruptIn tsop(p19);
Serial pc(USBTX, USBRX);
DigitalOut L1(LED1);
void trigger(){
pc.printf("\rtriggered!\n\n");
}
int main() {
pc.baud(9600);
pc.printf("\nPress any key when light turns on\r\n");
wait(5);
L1 = 1;
tsop.rise(&trigger);
while(1){
L1=!L1;
wait(.1);
}
}