I was working on a project, but suddenly the com port has started changing by itself every 10-25 seconds (changing between 2). It's super annoying because I only get to see the first 10 seconds or so of the serial monitor.
Anyone ever experienced something similar? How can I fix this?
Update: It happens right after I set a pin to low (to turn off a dc-dc converter to save battery).
The line that causes this is the following:
digitalWrite(0, LOW);
On an Uno or Mega pins 0 and 1 are used for communication with the PC. Don't use them for other stuff unless you know what you are doing.
What Arduino are you using?
If that does not solve your problem you need to post your complete program.
...R
Pin 0 is one of the serial port pins. Setting it low has nothing to do with "turning off the dc-dc converter" (whatever that means). Of course that is going to cause issues with the serial communications.
I have it controlling an external converter with pin 0. Good to know. I will move it to another pin then and see if that solves it. Thanks for your help.
(its a leonardo)
jamesus:
(its a leonardo)
I suspected it might be - but they are rarer than Unos.
Using Pins 0 and 1 on a Leonardo is less of a problem - they are connected to Serial1 rather than Serial.
The COM port is probably changing because something is making the Leonardo reset which breaks and re-makes its connection with the PC.
A possible cause of the reset is an overload or short circuit that reduces the 5volt supplyto a too low level.
...R