I want to connect the output pins of NXP MBED controller to 16 electromechanical relays,and 32 LEDs,what is the best way to do this?The relay would require a current of at least 300mA and LED would be 1.5-2.5V rating LED.And where can I find a datasheet that gives the input and output voltage and current specifications of each of the 40 pins in NXP MBED contoller's DIP package?When I look for it in google only the datasheets for the LPC1768/65/67,etc. turns up but not for the 40 PIN DIP MBED controller
The MBED microcontroller modules are merely the respective NXP microcontrollers implemented in a PCB with a wide DIP form factor, with supporting components.
In other words, they are like an Arduino Nano or Pro Mini. They are not made by NXP just like the Arduinos are not made by Atmel.
There is nothing unique about the mBed that would significantly alter the on-board microcontroller's ratings.
Thus, the input and output voltage and current ratings would be the same as for the respective microcontroller used in the board in question. The relevant datasheet will provide the information you need.
From the question, a microcontroller will typically not be able to source or sink 300 mA, that the relay drive coils require. Not only that, sourcing that much current from the regulated lines on the mBed boards will either overheat or destroy the on-board voltage regulator on those boards.
A recommended approach would be to power the relay's primary from an external power source, switching it via a logic-level MOSFET or BJT: The 2n7000 might be borderline suitable, as it is rated for 400 mA not counting requisite derating.
The MOSFET's gate would then be driven by logic outputs from the mBed, suitably protected by a small resistor (100 Ohms should do) in series with the gate. Also, a 10 kOhm pulldown resistor on the MOSFET gate would address spurious switching of the FET when the logic outputs are in high-impedance mode.