USBPause library usage for Arduino Micro

Hello, I am trying to use the USBPause C++ library in a sketch for the Arduino Micro board. I have looked over the “USBPause.h” in the library file but was wondering if there was an example Arduino sketch demonstrating the usage of this library?

The “USBPause.h” file has comments which mention that the USB related interrupts are disabled when the constructor is called and re-enabled in the destructor. Does this mean that the virtual com port connection between the Arduino and PC would be lost while the USB related interrupts are disabled and would reappear when the destructor is called?

Thank you.


You can see some examples of how to use our USBPause library for Arduino by looking in our AStar32U4 library. In particular, AStar32U4LCD.h and AStar32U4Buttons.h both use USBPause.

The results you get with this library will depend on how long you leave the USB interrupts disabled. If you leave them disabled for less than a millisecond, there should not be any problems with the USB connection. Do you need to disable the USB interrupts for longer than that?


Hi David,

Thank you for the information regarding the USBPause library usage. For my application I am using counter/timer1 and timer4 on the Arduino Micro. I am using the FreqCount library which uses the above mentioned counter and timer to measure the frequency of an external signal over a 1 second window. The USB interrupts are causing occasional delays in the timer4 ISR which controls the gate time for how long counter1 counts for. So my plan to resolve this was to disable the USB interrupts for 1 second while the counter/timer1 and timer4 were involved with time critical events of measuring the external signal’s frequency. Then the code would re-enable the USB interrupts long enough to transmit the frequency measured out via RS232. Then I would disable the UBS interrupt and return to making another 1 second frequency measurement of the input signal. This way the timer/counter1 and timer4 are not effected by the USB interrupts. This way my frequency measurements will be more consistent instead of the occasional jumps that I am currently seeing.

Thank you very much for your help and information.


Turning off USB interrupts for an entire second would probably be detrimental to the USB connection. However, if you are careful to only turn off USB interrupts after the device has been recognized by the computer and you have connected to it using your serial terminal program, then it might work.

It might be easier to disconnect USB altogether and send your results to the computer using the Arduino Micro’s serial interface and a USB-to-Serial adapter.


Thank you David. I think I will move forward with attempting to use the micro’s native uart along with a ttl to RS232 transceiver and RS232 to USB dongle. I think that makes the most sense and will be the easiest to manage from an interrupt standpoint. I very much appreciate your help with this issue.