first the arduino nano 33 iot was one device and example blink program worked properly.
then some serial output did not appear into the ide, so after setting up Serial.begin(9600) there was a second com port in windows 11, and it has the cannot start warning.
now the programming of the device works, but serial output does not work (only first serial text shows up). also the ide claims the upload does not work, there is an error.
how can it be so easy to break the functionality?
edit:
now the serial output without serial initialization works. I already tried to uninstall both of the usb port devices, but windows adds them back when re-connecting the device. Still the main arduino device in windows has the warning label (COM12), and the serial is a separate port (COM11). now the programming warning went away. Programming works only on the COM11 device, not on the named COM12 device.
seems like win11 does not add the arduino nano 33 iot as HID device, it tries to, when the mouse.h library is added to the code. what if this a win11 driver issue, HID issue, not the code issue.
consider the following mouse prototype code:
#include <Mouse.h>
#include <Arduino_LSM6DS3.h>
float ax=0.0f, ay=0.0f, az=1.01f, tol=0.005f, ltol=0.1f, dec=0.99f, mlt=1000000;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
if (!IMU.begin()) {
while (1);
}
Mouse.begin();
}
void loop() {
float x, y, z; float fps; float dx, dy, dz, dt; int mx, my, mz; bool mousemove = false; bool mouselift = false;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(y, x, z); fps = IMU.accelerationSampleRate(); dt=1.0f/fps;
ax=dec*ax+(1.0f-dec)*x; ay=dec*ay+(1.0f-dec)*y; az=dec*az+(1.0f-dec)*z; dx=x-ax; dy=y-ay; dz=z-az;
if (abs(dx)>tol) { mx=mlt*0.5*dx*dt*dt; mousemove = true; }
if (abs(dy)>tol) { my=mlt*0.5*dy*dt*dt; mousemove = true; }
if (abs(dz)>ltol) { mz=mlt*0.5*dz*dt*dt; mouselift = true; }
if (mouselift) {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
} else {
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
if (mousemove) {
Mouse.move(mx, my, 0);
}
}
}
}
again, it works as a mouse on a non-arduino IDE computer, not on the development computer, for some reason. any specific reason the arduino device/IDE should act like this?