SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By chrismax
#223355
Hello,

I am beginning with Redbord Artemis ATP and Qwiic connectors.

I need to work with BNO080 and M9N GPS. When I run my code, it works about a minute and after I loose BNO080. I have Is there a solution to have GPS informations each seconde and BNO080 ten per seconde?

Can somebody help?

Thanks for the help and sorry for my English...
Code: Select all
/*---------------------------------------------------------------------------------------------------GPS-----------------------------------------*/
#include <Wire.h> //Needed for I2C to GPS

#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;

long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
long Lat = 0;
long Long = 0;
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------BNO080--------------------------------------*/
//#include <Wire.h>      DEJA MIS PLUS HAUT POUR LE GPS

#include "SparkFun_BNO080_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_BNO080
BNO080 myIMU;
float CapBNO = 0;
float yaw = 0;
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/

void setup()
{
  
/*---------------------------------------------------------------------------------------------------GPS-----------------------------------------*/
  Serial.begin(115200);
  while (!Serial); //Wait for user to open terminal
  Serial.println("SparkFun Ublox Example");

  Wire.begin();

  if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
  {
    Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
    while (1);
  }
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------BNO080--------------------------------------*/
  //Serial.begin(115200);
  Serial.println();
  Serial.println("BNO080 Reading");

 // Wire.begin();

  if (myIMU.begin() == false)
  {
    Serial.println(F("BNO080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing..."));
    while (1)
      ;
  }

  Wire.setClock(400000); //Increase I2C data rate to 400kHz

  myIMU.enableRotationVector(50); //Send data update every 50ms

  Serial.println(F("Rotation vector enabled"));
  Serial.println(F("Output in form roll, pitch, yaw"));
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/

}

void loop()
{
  Lat = latitude();
  Serial.print("Latitude : ");
  Serial.print(Lat);

  Long = longitude();
  Serial.print("   -  Longitude : ");
  Serial.print(Long);

  CapBNO = capcompas();
  Serial.print("   -  Cap BNO080 : ");
  Serial.println(CapBNO);
}





//---------------------------------------------------------------------------------------------------------LATITUDE

long latitude()
{
    long latitude = myGPS.getLatitude();
    return latitude;
}

//-----------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------LONGITUDE

long longitude()
{
    long longitude = myGPS.getLongitude();
    return longitude;
}

//-----------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------CAP COMPAS BNO080
float capcompas() { //check compass to see current heading
 // Serial.print("FONCTION capcompas  ");

if (myIMU.dataAvailable() == true)
  {
//    float roll = (myIMU.getRoll()) * 180.0 / PI; // Convert roll to degrees
//    float pitch = (myIMU.getPitch()) * 180.0 / PI; // Convert pitch to degrees
      yaw = (myIMU.getYaw()) * 180.0 / PI; // Convert yaw / heading to degrees

//    Serial.print(roll, 1);
//    Serial.print(F(","));
//    Serial.print(pitch, 1);
//    Serial.print(F(","));
//    Serial.print(yaw, 1);
  }
  return yaw;
}

//-------------------------------------------------------------------------------------------------------------------

SERIAL :

Latitude : 461559165 - Longitude : -11316956 - Cap BNO080 : 29.58
Latitude : 461559156 - Longitude : -11316979 - Cap BNO080 : 29.57
Latitude : 461559142 - Longitude : -11316968 - Cap BNO080 : 19.14
Latitude : 461559140 - Longitude : -11316971 - Cap BNO080 : 19.14
Latitude : 461559133 - Longitude : -11316956 - Cap BNO080 : 29.59
Latitude : 461559126 - Longitude : -11316926 - Cap BNO080 : 29.56
Latitude : 461559124 - Longitude : -11316950 - Cap BNO080 : 28.57
Latitude : 461559124 - Longitude : -11316983 - Cap BNO080 : 6.95
Latitude : 461559124 - Longitude : -11316971 - Cap BNO080 : 12.46
Latitude : 461559129 - Longitude : -11316976 - Cap BNO080 : 28.96
Latitude : 461559129 - Longitude : -11316965 - Cap BNO080 : 28.90
Latitude : 461559139 - Longitude : -11316998 - Cap BNO080 : 28.92
Latitude : 461559155 - Longitude : -11316939 - Cap BNO080 : 28.92
Latitude : 461559286 - Longitude : -11316940 - Cap BNO080 : 43.46
Latitude : 461559290 - Longitude : -11316940 - Cap BNO080 : 110.20
Latitude : 461559319 - Longitude : -11316919 - Cap BNO080 : 109.64
Latitude : 461559331 - Longitude : -11316901 - Cap BNO080 : 109.63
Latitude : 461559337 - Longitude : -11316884 - Cap BNO080 : 108.07
Latitude : 461559353 - Longitude : -11316875 - Cap BNO080 : 108.24
Latitude : 461559360 - Longitude : -11316852 - Cap BNO080 : 108.10
Latitude : 461559354 - Longitude : -11316839 - Cap BNO080 : 108.05
Latitude : 461559342 - Longitude : -11316865 - Cap BNO080 : 108.01
Latitude : 461559343 - Longitude : -11316892 - Cap BNO080 : 107.70
Latitude : 461559345 - Longitude : -11316826 - Cap BNO080 : 68.51
Latitude : 461559345 - Longitude : -11316826 - Cap BNO080 : 68.51
Latitude : 461559345 - Longitude : -11316834 - Cap BNO080 : 68.51
Latitude : 461559298 - Longitude : -11316834 - Cap BNO080 : 68.51
Latitude : 461559272 - Longitude : -11316860 - Cap BNO080 : 68.51
Latitude : 461559272 - Longitude : -11316827 - Cap BNO080 : 68.51
Latitude : 461559265 - Longitude : -11316827 - Cap BNO080 : 68.51
Latitude : 461559265 - Longitude : -11316921 - Cap BNO080 : 68.51
Latitude : 461559192 - Longitude : -11316921 - Cap BNO080 : 68.51
Latitude : 461559184 - Longitude : -11316926 - Cap BNO080 : 68.51
Latitude : 461559184 - Longitude : -11316926 - Cap BNO080 : 68.51
Latitude : 461559184 - Longitude : -11316808 - Cap BNO080 : 68.51
Latitude : 461559162 - Longitude : -11316808 - Cap BNO080 : 68.51
Latitude : 461559155 - Longitude : -11316772 - Cap BNO080 : 68.51
Latitude : 461559155 - Longitude : -11316757 - Cap BNO080 : 68.51
Latitude : 461559161 - Longitude : -11316757 - Cap BNO080 : 68.51
Latitude : 461559107 - Longitude : -11316777 - Cap BNO080 : 68.51
User avatar
By chrismax
#223358
To have GPS all seconde, I used the millis fonction, but still a problem with BNO080...
User avatar
By chrismax
#223450
I solved the problem after many tries...it comes from my surface Pro 7... With an other computer, it works well.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum