I will be demonstrating the Nano R4 in my next video, but I ran into an issue when trying to demonstrate the use of the Op Amp.
Both the sketch outlined in the Nano documentation and the example sketch installed with the R4 boards manager fail with the same error - the OPAMP Library is not compatible with the Nano R4.
Rather infuriating, as I had already made the animation showing the Op Amp features and hookup, only to find out it won’t work!
I fixed the problem by editing the OPAMP.cpp file in the OPAMP library. Specifically, I commented out the lines that checked the board type, as follows:
/* Make sure this library fails to compile for unsupported boards. */
//#error "Unsupported board for OPAMP library."
//#endif
It’s lines 5, 6, and 7 that I commented out (I tried editing it with “ARDUINO_NANOR4”, but it didn’t work; it must be the wrong board identifier). It saved the video, but I should never have had to do that.
If anyone at Arduino is monitoring this, I suggest that you modify this library as soon as possible.
Hi @DroneBotWorkshop. Thanks for your report. I apologize for any inconvenience this bug has caused.
The developers have already fixed the bug:
Unfortunately there hasn't been a release of the "Arduino UNO R4 Boards" platform since the time of the fix, so this is why you still encounter the bug when using the release version of the platform available from Boards Manager.
I'm looking forward to watching your video!
You can use the macro ARDUINO_NANO_R4:
You can also use ARDUINO_nanor4:
(note the -DARDUINO_{build.board} in the command pattern)
however, I'm not a big fan of that departure from the "SCREAMING_SNAKE_CASE" convention of macro names.
Thanks, that explains a lot. Do you know when the Boards Manager update will be pushed out?
I also noticed that many of the example sketches for the Nano R4 are actually Uno R4 sketches, and several of them have no chance of working with the Nano R4. For example, there are WiFi examples and a section of sketches for the matrix display on the Uno R4 WiFi. Might be confusing for some folks.
Unless, of course, you plan on releasing a WiFi version of the Nano R4 (I actually think that could be a winner if it were priced reasonably). Even then, you’d have trouble fitting the LED matrix onto the board!
I’ll update the video comments with a sticky comment about the board’s manager. And if you want to see it, you can view it at https://youtu.be/Ss3fiDQKy4g
I do not. However, I have notified the maintainers of the platform that users are being impacted by the problem so that they can take this into consideration in scheduling the next release.
I agree this is confusing. There isn't actually a mechanism by which Arduino IDE can understand whether a given example is compatible with a specific board. It only has compatibility information to an architecture-level granularity.
So the use of the board name in the heading name of the "Examples for Arduino Nano R4" section of the "Examples" menu is misleading. I submitted a proposal for changing the section heading to something that is guaranteed to be accurate here:
There is also a proposal for making it possible for compatibility to be specified to a board level granularity in library metadata here:
If that compatibility information was available, it could be used by Arduino IDE to filter and tailor the content of the "Examples" menu.
Please check what you said in the part about the DAC, for your for loop I'm pretty sure you said it goes from 1 to 5 when it actually goes from 0 to 4.
Hello again @DroneBotWorkshop. Version 1.5.1 of the "Arduino UNO R4 Boards" platform has now been released. This version has the fix for the bug in the "OPAMP" library.
There is a local cache of the index file Boards Manager uses to determine which versions of the platforms are available, so it takes some hours for the update to appear in the Boards Manager of every user (depending on when Arduino IDE happened to last download the index on that specific machine), but it will be universally available soon.