Ok, I’m sure I’m missing something here, and hoping someone can set me straight.
I was trying to see how much better the performance of the new UNO Q was compared to my older UNO R4 as I need the extra bandwidth, but to my surprise, the Q seems to be about 1000 time slower!!
I ran a VERY simple program (See at the end of this) - it simply increments an unsigned long on each cycle of “loop”, and every 20 seconds it outputs the current value and resets it to zero. As I said, really simple.
As I am testing both the UNO R4 WiFi and UNO Q, I have two versions of the program - one that outputs to “Serial”, and the other that outputs to “Monitor” using the “Arduino_RouterBridge”. Literally, the only changes are the “include” statement and the name change from “Serial” to “Monitor”.
These are the results I get every 20 seconds
Uno R4 Wifi outputs a current value of 19,144,119 +/- a couple of 100.
UNO Q - outputs a current value of 18,183 without variation. That is 1000 times slower.
Here is the code …
UNO R4 WiFi
unsigned long ulCount = 0;
uint8_t iSeconds = 20;
unsigned long ulPreviousTime;
void setup() {
Serial.begin(9600);
Serial.println(F("UNO Processor Speed check"));
ulPreviousTime = millis();
}
void loop() {
if ((millis() - ulPreviousTime) > (1000 * iSeconds)) {
Serial.print(F("Count is : "));
Serial.print(ulCount);
Serial.println();
ulCount = 0;
ulPreviousTime = millis();
}
ulCount ++;
}
/*
Produces this output
17:36:50.078 -> Count is : 19144119
17:37:10.070 -> Count is : 19144081
17:37:30.103 -> Count is : 19144143
*/
And for the UNO Q
#include <Arduino_RouterBridge.h>
unsigned long ulCount = 0;
uint8_t iSeconds = 20;
unsigned long ulPreviousTime;
void setup() {
Monitor.begin();
Monitor.println(F("UNO Processor Speed check"));
ulPreviousTime = millis();
}
void loop() {
if ((millis() - ulPreviousTime) > (1000 * iSeconds)) {
Monitor.print(F("Count is : "));
Monitor.print(ulCount);
Monitor.println();
ulCount = 0;
ulPreviousTime = millis();
}
ulCount ++;
}
/*
Produces this output
Count is :
18183
Count is :
18183
Count is :
18183
*/
Ok, so it was a quick enough change to check again for overflow. Ran it on a cycle of 1 second on both boards.
The results are
UNO R4 WiFi : 957,400 +/-
UNO Q : 910
These results scale with the previous values, and with the UNO Unsigned Long having a max value of 4,294,967,295 I’m confident the reported values I’m seeing are what they are without overflow
Probably has to do with the 'Bridge'. when the code is used with it the counter is indeed at 910 after a second. But when you do something like this (without using the bridge) the 5 million is reached instantly
unsigned long ulCount = 0; // Counter variable
bool ledBlinking = false; // Whether LED should be blinking
unsigned long lastBlink = 0; // For blink timing
bool ledState = false; // Current LED state
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // LED off on most boards
Serial.begin(115200);
}
void loop() {
ulCount++;
// When count reaches 5 million, start blinking
if (ulCount >= 5000000UL) {
ledBlinking = true;
}
// Blink the LED if we're in blinking mode
if (ledBlinking) {
if (millis() - lastBlink >= 500) { // toggle every 500ms
ledState = !ledState;
digitalWrite(LED_BUILTIN, ledState ? LOW : HIGH); // LOW=ON on most boards
lastBlink = millis();
}
}
}