Pas faux:-) mais en fait il s'agit des exemples fournis dans les librairies, je n'ai rien changé.
Voici l'exemple de code Euler.ino pour lire les angles de rotation :
#include "NAxisMotion.h" //Contains the bridge code between the API and the Arduino Environment
#include <Wire.h>
NAxisMotion mySensor; //Object that for the sensor
unsigned long lastStreamTime = 0; //To store the last streamed time stamp
const int streamPeriod = 20; //To stream at 50Hz without using additional timers (time period(ms) =1000/frequency(Hz))
void setup() //This code is executed once
{
//Peripheral Initialization
Serial.begin(115200); //Initialize the Serial Port to view information on the Serial Monitor
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
//Sensor Initialization
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired
mySensor.setUpdateMode(MANUAL); //The default is AUTO. Changing to MANUAL requires calling the relevant update functions prior to calling the read functions
//Setting to MANUAL requires fewer reads to the sensor
}
void loop() //This code is looped forever
{
if ((millis() - lastStreamTime) >= streamPeriod)
{
lastStreamTime = millis();
mySensor.updateEuler(); //Update the Euler data into the structure of the object
mySensor.updateCalibStatus(); //Update the Calibration Status
Serial.print("Time: ");
Serial.print(lastStreamTime);
Serial.print("ms ");
Serial.print(" H: ");
Serial.print(mySensor.readEulerHeading()); //Heading data
Serial.print("deg ");
Serial.print(" R: ");
Serial.print(mySensor.readEulerRoll()); //Roll data
Serial.print("deg");
Serial.print(" P: ");
Serial.print(mySensor.readEulerPitch()); //Pitch data
Serial.print("deg ");
Serial.print(" A: ");
Serial.print(mySensor.readAccelCalibStatus()); //Accelerometer Calibration Status (0 - 3)
Serial.print(" M: ");
Serial.print(mySensor.readMagCalibStatus()); //Magnetometer Calibration Status (0 - 3)
Serial.print(" G: ");
Serial.print(mySensor.readGyroCalibStatus()); //Gyroscope Calibration Status (0 - 3)
Serial.print(" S: ");
Serial.print(mySensor.readSystemCalibStatus()); //System Calibration Status (0 - 3)
Serial.println();
}
}
Et pour ce qui est du câblage, et bien il n'y en a aucun, j'ai juste plugué le shield 9 axis sur la carte uno.
J'ai essayé également l'exemple de projet ici : https://create.arduino.cc/projecthub/techmirtz/using-9-axes-motion-shield-with-arduino-e71107?ref=search&ref_id=9%20axis&offset=0
ça compile mais toutes les valeurs à 0.
L'impression que j'ai est que l'arduino ne communique pas avec le shield.
D'après le code je crois comprendre que les deux communiquent via le bus I2C.
J'ai trouver un programme de scan du bus I2C et quand il s'execute il ne trouve rien, donc je pense que le shield n'est pas détecté.
J'ai trouvé qq articles qui parlent des lignes SDA et SCL nécessaires au bus I2C. Est ce qu'il faut connecter des broches complémentaires pour ces lignes même quand on a plugué le shield dans le connecteur de l'arduino ?
Merci d'avance
David