My doubts are, how to know if the USB is able to provide enough power for my current setup?

You need to know in advance what the voltage and current requirements are for anything you connect to the Arduino, and ensure it is compatible with what you're connecting it to. While you are unlikely to damage the USB itself, it is very easy to damage the Arduino output pins by connecting something that draws too much current from it.

I only provide help via the forum - please do not contact me for private consultancy.

You need to know in advance what the voltage and current requirements are for anything you connect to the Arduino

Actually the .5amp 5vdc limit is enforced with a on-board 500ma thermofuse on the arduino board, so the limit applies to both USB 1,2, or 3. Note that if you are powering the board via the arduino external power connector then you can draw a little more current then the 500ma USB limit, depending on the actual voltage applied to the external power connector or Vin pin.

Lefty

I guess so, I could also use an Amperemeter connected in series with the +5v line of the USB cable, right?

Yes but it's the max average forward current that will determine what you run your leds at. 20ma is the current limit you should use for these leds set by the size of a series current limiting resistor between each output pin and the led.

Does this means that with 6 or 7 leds I would be reaching the limit of the board? Also the Mega documentation says each port delivers only 40ma so I don't get it.

Each pins has an absolute max 40ma rating, and 30ma pin output current or less is safer valueto run the output pins at. So 7 leds running at 20ma is 140ma total, which is well within the boards +5vdc current capacity and each output pins rating.

The key is it is up to you to manage the total current requirement for the complete project. If driving standard 20ma leds you do that by proper sizing of the current limiting resistors you have to have between the output pins and the leds.Lefty

Almost, you have to factor in the forward voltage drop of the leds you are working with. Your blue leds have a, lets call it a 3.5 Vf rating. So the V to use in your formula is Vcc (+5vdc) - Vf (3.5vdc), So with a 1k ohm resistor the current value will be 1.5ma, which is pretty dim but usable.

If you want to solve for the resistor size that will limit current to 20ma then R= (5-3.5)/.02 = 75 ohms.

I guess so, I could also use an Amperemeter connected in series with the +5v line of the USB cable, right?

Current over the USB interface is not likely to be the limiting factor, and in any case by the time you've measured the actual current it's a bit late to be thinking about whether you've just overloaded something, isn't it?

You need to read and understand the electrical spec of whatever it is that you're planning to connect, to ensure that it will not damage or be damaged by the Arduino.

I only provide help via the forum - please do not contact me for private consultancy.