I am trying to connect a 9 Axis Motion Shield to a Giga R1 WiFi board but cannot seem to get them to communicate with each other.
I suspect that the library is the culprit as the error code is:
"'IMU' was not declared in this scope"
I am using the #include <Arduino_NineAxesMotion.h> library that is recommended for this Shield and it also says that it's compatible with all Arduino architectures according to the library author. However, the product side says it's only comaitble with Uno R3 and UNO Wifi Rev2 Boards, but I tried with my UNO R3 board with no success.
Is there a different library to use that works, or should I opt for a different Motion shield or a different Board, other than Giga R1 or UNO R3?
Took a quick look at the shield and library you are using. Looks like its set up for using Wire as opposed to Wire1. You are going to have to modify the library to use Wire1 instead of Wire. There is no way programmatically to change change.
Being a newbie to coding and Arduino, it seem this fast ran up and away from my competence level (posing as a fourth grader by way of CHAT GPT...).
Having tried several fault-source finding solutions (proposed by Chat GPT) I landed in that the Library might be the culprit. Changing / fixing the library is way out of my league...
in my code I start with including the library:
#include <Arduino_NineAxesMotion.h>
And then, in the void setup () initializing the gyro:
// Initialize Gyro (Motion Shield)
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
Serial.println("IMU initialized.");
This gives the error message "'IMU' was not declared in this scope".
Also, this newbie has never been on Github...
My "Plug & Play" project is turning into a "Plug & Pray" project...
Take a look at the examples included with the library, start will BareMinimum.ino to see the basic structure and then maybe Motion.ino. You can find them in the IDE under [File]/[Examples]
try pressing the reset button twice in quick succession to put the giga into bootloader mode. the green led should then be blinking fast. then select the new port in the IDE that will have just appeared and try uploading again
Fantastic! Thanks again @steve9!
Got to upload it with only a smaller error code on the dfu, but got the program running.
Now I just got to the correct readings out from gyro and accelerometer as they are 0,00, even if I tilt it. Guess it's a pin-conflict somewhere. I had a pin7 conflict running the same code with the UNO board, and now I get the same readings as before resolving that conflict. Guess I will have to trial and error my way around it... Maybe run a simpler code to do my bugfinding...