Serial Monitor is behaving strangely on my Arduino Uno Q. It does not display the simplest messages, either in the Arduino IDE 2.3.7 or in Arduino App Lab 0.3.2.
#include <Arduino_RouterBridge.h>
void setup() {
// put your setup code here, to run once:
Monitor.begin();
delay(5000);
Monitor.println("Starting Message");
}
void loop() {
// put your main code here, to run repeatedly:
Monitor.println("First Message");
delay(500);
Monitor.println("Second Message");
delay(500);
}
Hi @bremerf1. Until the developers can fix the problem, as a workaround you can revert back to using version 0.52.0 of the "Arduino UNO Q Board" platform (machine identifier arduino:zephyr). I'll provide instructions you can follow to do that:
Workaround when Using Arduino IDE
Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
Find the "Arduino UNO Q Board" entry in the list of boards platforms.
Select "0.52.0" from the drop-down menu in the "Arduino UNO Q Board" entry.
Click the "INSTALL" button at the bottom of the entry.
Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:
Successfully installed platform ...
Arduino IDE will occasionally notify you that a new version of the boards platform is available, you'll need to refrain from accepting the offer that will cause an update back to the problematic version of the platform. If you find these notifications annoying, you can disable them via the advanced settings.
I'll provide instructions you can follow to do that:
Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
A menu will appear on the editor toolbar:
Select the "Preferences: Open Settings (UI)" command from the menu. ⓘ You can scroll down through the list of commands to find it or type the name in the field.
A "Settings" tab will open in the Arduino IDE main panel.
Type arduino.checkForUpdates in the "Search Settings" field of the "Settings" tab.
Uncheck the box under the "Arduino: Check For Updates" setting.
Close the Settings tab by clicking its X icon.
If you disable the automatic update check, make sure to periodically do a manual check for newer versions of Arduino IDE and your installed boards platforms and libraries.
You can check for new versions of Arduino IDE by selecting Help > Check for Arduino IDE Updates from the Arduino IDE menus.
You can check for new versions of boards platforms and libraries by the following procedure:
Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
Select the "Arduino: Update Indexes" command from the menu.
A notification will appear at the bottom right corner of the Arduino IDE window to indicate the progress of downloading the index files which provide Arduino IDE with the information about which versions of platforms and libraries are available.
Wait for the index file download process to finish.
Select Tools > Board > Boards Manager... from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
Select "Updatable" from the "Type" menu in the Boards Manager view.
A list of installed boards platforms for which updates are available will be listed.
Click the "UPDATE" button on the entry for any platform you wish to update.
Select Tools > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
Select "Updatable" from the "Type" menu in the Library Manager view.
A list of installed libraries for which updates are available will be listed.
Click the "UPDATE" button on the entry for any library you wish to update.
Workaround when Using Arduino App Lab
Start Arduino App Lab and connect it to your UNO Q board (if using the board in PC hosted mode).
If you are using the board in PC hosted mode, click the >_ ("Connect to the board's shell") icon near the bottom left hand corner of the Arduino App Lab window. Otherwise, open the terminal via the desktop menu.
A terminal window will open.
Type the following command in the terminal window:
arduino-cli core install arduino:zephyr@0.52.0
Press the Enter key.
You will see output printed that indicates the progress of installing version 0.52.0 of the arduino:zephyr platform.
Wait until the installation process finishes successfully.
Close the terminal window.
Open your App in Arduino App Lab.
If your App is already running, click the "Stop" button and wait for the App to be stopped.
Click the "Run" button.
You should now find that the Serial Monitor content is as expected.
Arduino App Lab will periodically offer to update the "Arduino UNO Q Board" platform back to the problematic version 0.53.0. If you accept the update offer, the problem with the Serial Monitor output will come back. However, you should keep an eye out for the availability of a new release of the "Arduino UNO Q Board" platform (e.g., 0.54.0). Once that comes out, you should update, as this may have the bug fix and also other important enhancements and bug fixes.
Sorry, I forgot to specify that you must upload the sketch again after you install version 0.52.0 of "Arduino UNO Q Board" platform. It is expected that the problem will still occur if the board is still running a sketch program that was uploaded while 0.53.0 was installed.
Give that a try and let us know if you still have the problem.
I’ve had the same problems with Monitor. I get reliable results if instead of Monitor I use the Bridge to call a Python function that prints, e.g.
Python
import time
from arduino.app_utils import *
def bridgePrint(text):
print(text)
def loop():
"""This function is called repeatedly by the App framework."""
# You can replace this with any code you want your App to run repeatedly.
print("Hello world!")
Bridge.provide("bridge_print", bridgePrint)
App.run(user_loop=loop)
Sketch
#include <Arduino_RouterBridge.h>
int intervalMs1 = 100;
int intervalMs2 = 2000;
unsigned long nextTimeMs1 = 0;
unsigned long nextTimeMs2 = 0;
void printIt(const String text) {
String outText = String(millis()) + " " + text;
//Monitor.println(String(now) + " " + text);
Bridge.notify("bridge_print", outText);
}
bool timeReached(unsigned long nextTimeMs) {
if (nextTimeMs == 0)
return false;
return (millis() >= nextTimeMs);
}
void setup() {
Bridge.begin();
Monitor.begin();
delay(5000);
unsigned long now = millis();
printIt("Starting...");
nextTimeMs1 = now + intervalMs2;
nextTimeMs2 = nextTimeMs1 + intervalMs1;
}
void loop() {
unsigned long now = millis();
if (timeReached(nextTimeMs1)) {
nextTimeMs1 = now + intervalMs2;
printIt("First Message");
}
if (timeReached(nextTimeMs2)) {
nextTimeMs2 = now + intervalMs2;
printIt("Second Message");
}
}
As recommended elsewhere, I’m using timing logic rather than delay() in the sketch’s loop() function.
Also as recommended, I’m using Bridge.notify() rather than Bridge.call(), as my bridge_print function has no result.
@jgmdavies That's one way to do it. and also when you run your app in Arduino App Lab, the Serial Monitor in the Arduino IDE displays messages alright.
… many thanks for this example. This finally shows some output on the monitor. Now the journey with Arduino UNO Q, Linux and Python can start. thanks again. Your example should be placed in the manual of Arduino UNO Q. :0)
If you want to do a lot of logging from the sketch and are worried about possible effects on timing, I’m also experimenting with a FIFO to buffer the log strings. I then regularly push a String containing multiple log lines to the Python side (or you can pull from the Python side) - so fewer calls across the Bridge.
Wondering if this could also work when you upload a sketch using the Arduino IDE. That is is there a default Python script, and can it be modified to add some of these capabilities...