1

I have searched this topic almost everywhere also got different results that couldn't satisfy me

My new project is a 4x4 LED cube

Of which

Will contain 4 Rows and each Row will contain 16 LEDs

So, I need to use all the digital pins 0-15 as digital output.

And other pins 16-20 for grounding.

But the problem is, this project needs d0 and d1 pin to be connected as a digital output pin. (Not Serial communication)

In some places I have seen that Experts saying

  1. If you want to use Serial communication, then you can't use them.
  1. You can't use it while your arduino is connected to PC.
  1. You Can't do this ,as this may harm the device
  1. You must turn off serial connection first.

OK, reading this, I got confused, I don't need to use any serial connection (console and others) in this LED cube project so I tried to turn off serial connection by not writing the code below.

Serial.begin(9600);

So, will that free those d0 and d1 pins as digital for me ? Or USB connection is also considered as a serial connection?

So, how can I do it? And will doing it really harm my board?

2

If you don't use the serial port, pins 0 and 1 are regular I/O pins. It's just as simple as that.

If you want to use Serial communication, then you can't use them.

Correct.

You can't use it while your arduino is connected to PC.

Wrong. You can keep the USB cable connected as a power supply. You will not be able to use it for communication though.

You Can't do this, as this may harm the device

What is “this”? The device can be harmed if you drive too much current to/from an I/O pin, irrespective of whether it's a pin that could be used for serial communication.

You must turn off serial connection first.

Only if you did turn it on before. If you never enable Serial, you don't have to do anything more.

2
  • An LED consumes approximately 3 volts and 30 mA (maximum rate) and the output of arduino pins are 5 volt and 40 mA, so , this shouldn't harm my board, so, Not writing the code 'Serial.begin(9600);' code will solve my problem right? – Subha Jeet Sikdar Sep 26 '20 at 10:12
  • @SubhaJeetSikdar: 40 mA is the “absolute maximum rating”. Under normal working conditions, you should normally not source more than 20 mA from a single pin. Note that there are also limits on the sum of the currents sourced by a single port. See the datasheet. – Edgar Bonet Sep 26 '20 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.