I’m new here and wanted to use med LPC1768 µc board.
I’d like to know if the analog inputs could be use as digital inputs ?
Does anyone can show me few code to declare this ?
I was thinking about juste like this :
DigitalIn myDigitalSignal(p20); // p15 to P20
Thank you in advance.
Yes, all signal pins from p5 to p30 can be used as digital inputs.
Other than p19 and p20 they can also all be used as interrupt inputs if needed.
Thank you @AndyA,
you’re the one !
Can you please indicate me were did you get this information ?
Is this only your self experiment or did you just RTFM ?
Unfortunatly for me I’ve already route my trace on P19,
Gosh, 2 chances over 25! F#!*k …
That lack of interrupt inputs on those two pins isn’t that clear from the mbed documentation.
If you look at the the mbed library source code which maps the user friendly p5 to p30 names to processor port pins you will see that p19 and p20 are connected to IO port 2 on the processor, all the others are connected to ports 0 or 1. Alternatively you can also see this if you look at the schematic for the board.
If you then look at the user manual for the LPC1768 in the section about GPIO interrupts it tells you that only ports 0 and 1 can be used as interrupt sources.
If it makes you feel any better I only worked this out after I got the boards back with an interrupt signal connected to p19.
p19 is still fine to use as a digital input (or digital output). If you do need it as an interrupt then it looks like p18 is unused on your design so you can probably just short between the two and use p18 instead.