Could you expand on that? 40ma is over the threshold that the Arduino can supply safely using the on-board power?
Your main limits are 40 mA per pin, up to 200 mA total; that means (in theory) you could bring 5 i/o pins to a digital HIGH state, and draw 40 mA from each, and be safe. Draw any more, or use a sixth pin, and you're hosed (well, your ATMega is, anyhow).
That's in theory. In -practice-, you probably don't want to exceed 20-25 mA per pin, or even less, depending on how many pins you plan to use at any one moment of time. That, and you never want to use any component at the limits of its design, as that can be asking for trouble (unless you have no other choice, and even then you better think hard about what you are doing).
Download the datasheet for the ATMega328 from Atmel; it will tell you all you need to know and then some:
For your motor, you will most definitely want to use a transistor or mosfet driver of some sort to control it, as it will likely pull more than 40 mA. Even if it didn't, you should always use an interface of some sort (and know the current needs for that interface) for any external electronics you are interfacing that require power to control (so-called "active" components, mainly).
For motors, there are plenty of examples around (just google for "arduino motor control") for simple single transistor motor control, as well as more complex (but still fairly simple to understand) h-bridge controllers using both discrete components (transistors/mosfets) as well as packaged IC devices.
![]()