Pin with 5 V or 0 V

Hello community

I am using a at mega 2560 arduino microcontroller. Is there a pin on it, able to toggle between 5 V and 0 V. I want to toggle via computer code (Atmel studio 6 C code).

Scandinavian students

All of them, I would say.

digitalWrite(pin, HIGH); // gives 5V
digitalWrite(pin, LOW); // gives 0V

note that you can draw only small currents, somewhere in the 50mA range max. i guess (check the specs)

More like 20 mA - also check for the maximum amount for the chip. That is, you can't draw 20 mA from all pins at the same time.