Experienced strange output in a complex motor controller sketch. So I wrote the following sketch to see what happens. Same garbled output.
#include "Arduino_RouterBridge.h"
int a = 0;
int b = 1;
void setup() {
// put your setup code here, to run once:
Monitor.begin();
}
void loop() {
// put your main code here, to run repeatedly:
Monitor.print("a = ");
Monitor.println(a);
Monitor.print("b = ");
Monitor.println(b);
Monitor.print("a + b = ");
Monitor.println(a+b);
a += 1;
b += 1;
delay(1000);
}
I wanted to port a more complex sketch for motor controller from Uno to Uno Q.
This is only a test for calculations and output in the Serial Monitor.
Bridge.begin() alone did not change the situation with wrong end of line commands.
I will try data relay to Python and output in the shell later.
The good thing is: all this is preliminary code. Overall objective is a remote control of a robot car, where a 5-digit-code must be split into 3 components for "forward", "curve" and "button". I could see that this works properly.
Does not make a difference. Neither as part of the string concatenation nor as stand-alone print statement.
Conclusion: FIFO and line feed are not yet working properly.
Now, this part is excellent. Printout as expected, Code seperated in its components.
No println(), an empty line produced with
printout = "\r";
Monitor.print(printout);
But here, the code stems from the Python program through the Bridge. The overall objective is a remote control with HC-12 (433MHz). That's another issue.
If anyone is curious..
I've been looking real hard at this for few days now..
println calls monitor write twice not necessarily a newline issue..
1st call we get the string..
the next call has 2 chars, i haven't bothered to check i'm sure it's just a newline and carriage return..
i think i'm starting to get my bridge to a stable state..
i would like to override println and see if I can get that to just one call to write??
my write is tight, blocking with the mutex, current code is loose..
need more testing time myself..
my test sketch..
I've determined it's probably somewhere else..
Quite easy to see add a k_msleep(10) to the top of monitor write..
After taking out my debug prints, it went sideways..
If I insert a 10ms delay, added it to the end before releasing mutex then it all got better..
Was my first test to try this morning, installed orig code and added the delay..
added it to the top..
cleaned it right up..
println does try to clobber with two quick punches..
the other end not fast enough??
or we need a sequence added..
just another episode of as the code compiles.. src.zip (11.3 KB)