Hi,
any Hotkey can do it?
Thanks
Adam
What exactly do you want to do ? It is not obvious from the title of the topic
the serial monitor shown data very fast, how can stop or pulse it to do analyze。
I just remove the USB cable now.
In the serial monitor there is a checkbox that you can uncheck to stop auto scroll.
Or put delays in your code with delay or millis() timing to slow the output of serial data.
I know of three ways to do this:
first way is to disable autoscroll in the serial monitor
second way is to use the dbgi-macro like in the demo-code posted below
third way: modifiy your code that the debug-output depends on a switches state
and use a print-debug-function that has something like this
if (DebugSwitch == HIGH) {
Serial.print();
}
Me personal I prefer the dbg and the dbgi-macro because it is much shorter to write
// start of macros dbg and dbgi
#define dbg(myFixedText, variableName) \
Serial.print( F(#myFixedText " " #variableName"=") ); \
Serial.println(variableName);
// usage: dbg("1:my fixed text",myVariable);
// myVariable can be any variable or expression that is defined in scope
#define dbgi(myFixedText, variableName,timeInterval) \
do { \
static unsigned long intervalStartTime; \
if ( millis() - intervalStartTime >= timeInterval ){ \
intervalStartTime = millis(); \
Serial.print( F(#myFixedText " " #variableName"=") ); \
Serial.println(variableName); \
} \
} while (false);
// end of macros dbg and dbgi
unsigned long MyTestTimer = 0; // variables MUST be of type unsigned long
//helper-function for non-blocking timing
boolean TimePeriodIsOver (unsigned long &periodStartTime, unsigned long TimePeriod) {
unsigned long currentMillis = millis();
if ( currentMillis - periodStartTime >= TimePeriod )
{
periodStartTime = currentMillis; // set new expireTime
return true; // more time than TimePeriod) has elapsed since last time if-condition was true
}
else return false; // not expired
}
unsigned long myFastCounter;
unsigned long mySlowCounter;
void setup() {
Serial.begin(115200);
Serial.print( F("\n Setup-Start \n") );
myFastCounter = 0;
mySlowCounter = 0;
}
void loop() {
myFastCounter++;
// loop is running fast but only once per second (1000 milliseconds)
// the value myFastCounter is printed to the serial monitor
dbgi("dbgi-demo",myFastCounter,1000);
// non-blocking timing-function
// evaluates true only if milliseconds given as the second parameter
// have passed by
if (TimePeriodIsOver (MyTestTimer,2000) ) {
mySlowCounter++;
dbg("dbg-Demo",mySlowCounter);
}
// if you un-comment the line below. The serial monitor will be flooded
// with messages
//dbg("dbg-flooding-demo",mySlowCounter);
// this demosntrates why dbgi is the better choice in fast running loops
}
best regards Stefan
Thanks.
BTW: unchecked the autoscroll doesn't work in my side, the data still run.
Which version of the IDE and which Operating System ?
Thanks.
1.8.3
And the OS ?
How about installing a much later version of the IDE ?
Thanks.
I am using WIN7.
keep this Version to upload to NANO, that newer version may not do.
Why do you say that ?
I can only upload to NANO by this version at least tested in my pc then.
so this means
you installed Arduino-IDE version 1.8.12 or 1.8.13 tried to upload code to an arduino nano and it did not work?
best regards Stefan
Thanks.
Exactly.
When you try to upload with a newer version of the IDE, do you get any error message? if so, post the entire error message in code tags.
What actually happens?
Thanks.
here: Nano upload Access is denied
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.