Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Adruino Micro
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adruino Micro

by minerd on Sun Jan 23, 2022 8:49 pm

Hi Guys, I started working with the Arduino Micro for the first time and I'm having an issue. When I'm running a loop and feeding the loop state through the Serial Monitor, I disconnect the Serial Monitor and my micro speed drops to about 500ms intervals and I have to reset or reboot the micro to get the normal loop speed back, I'm not sure why I'm getting this behavior. Can someone give me an idea why this is happening? My code is listed below. I'm running a 16x1 LCD but it has no effect either way.

Thanks
Your help is appreciated.
Derrick

//#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"
Adafruit_LiquidCrystal lcd(0x23);

byte X=0;//Global Variable//
void setup() {
Serial.begin(9600);
lcd.begin(16, 1);
lcd.clear();
lcd.home();
pinMode(13,OUTPUT);
lcd.print("------>");
}

void loop() {
Serial.println(X);
X=X+1;
lcd.setCursor(7, 0);
lcd.print(X);
lcd.print("<-------");
if(X==255)
{
lcd.clear();
lcd.print("------>");
X=0;
}
digitalWrite(13,HIGH);
//delay(25);
digitalWrite(13,LOW);
//delay(25);

}

minerd
 
Posts: 10
Joined: Fri Dec 01, 2017 5:34 pm

Re: Adruino Micro

by mikeysklar on Tue Jan 25, 2022 7:26 pm

Derrick,

What happens when you comment out all the Serial.*() references and run the code?

mikeysklar
 
Posts: 7560
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adruino Micro

by minerd on Tue Jan 25, 2022 8:31 pm

It works fine with and without the serial code, it's just when I open the Monitor window and it' starts to print in the monitor, I close the monitor and the delay happens like it's still trying to print to something. I open the monitor back up and the speed resumes, it's like it never disconnects once you view the monitor. If I read the external A0 port some external input and compare using the "if" statement ,ex,
-byte Val = analogRead(A0);
-if(Val<=50)
{
Serial.println(Val);
}
then close the Monitor once this completes it works fine, or with some other external input. When I'm feeding it a loop value and close the monitor window it's like the Arduino doesn't seem like it knows to close the comm connection and resume it's previous operations.
i hope this makes since.

try to run the code I posted and you''ll see what it's doing.

Thank you for the quick help it's much appreciated, I'm eager to get your reply.

Derrick

minerd
 
Posts: 10
Joined: Fri Dec 01, 2017 5:34 pm

Re: Adruino Micro

by mikeysklar on Wed Jan 26, 2022 11:45 am

Derrick,

Two suggestions to try.

One increase you baudrate to 115200.

If you open and close the serial monitor you can cause the board to reset which can change the behavior. Ideally you would hold the serial monitor open from the start.

mikeysklar
 
Posts: 7560
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adruino Micro

by minerd on Wed Jan 26, 2022 9:08 pm

I tried the speed change but it didn't seem to work. It's like the board holds onto the comm connection and won't drop it and resume previous operations, but it will if theirs an external trigger, with this loop it seems like it can't break out of it. If I open the monitor through a portion or the loop on some external triggers it will remember what apart of the loop I monitored and the speed changes only on the affected part of the count state, it has to be setting a flag and not clearing it. I'm extremely familiar with PIC Chip firmware, I haven't fooled with Atmel though. I'm not sure what to make of this.
Derrick

minerd
 
Posts: 10
Joined: Fri Dec 01, 2017 5:34 pm

Re: Adruino Micro

by mikeysklar on Thu Jan 27, 2022 1:41 pm

Let's go back to the baudrate issue. When you changed it you said it did not seem to work. Had you changed the baudrate both in the source code and in the bottom right corner of the serial monitor?

Some related discussion on serial monitor slow downs when closed.

https://forum.arduino.cc/t/serial-print ... sed/545967
https://forum.arduino.cc/t/serial-print ... ial/483017

mikeysklar
 
Posts: 7560
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adruino Micro

by minerd on Thu Jan 27, 2022 9:16 pm

yea I've tried to change it in both places, I guess technically it won't interfere with my ultimate objective. Guess I just figured the popularity of the device they would have gotten the bugs out. I took a look at your links, issue is very similar I'm still not sure whats causing the problem. I spent a handful of hours troubleshooting it and running it through various scenarios to see how it's going to act and then ran into this one, hopefully I can get an idea what's going on. I can still use it for my purpose, I'm just surprised this issue hasn't been caught and corrected.

Derrick

minerd
 
Posts: 10
Joined: Fri Dec 01, 2017 5:34 pm

Please be positive and constructive with your questions and comments.