Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control Nicla from an Asset Tracker/Samd51 through eslov/I2C ... Example not working for me #71

Open
jwalway opened this issue Nov 10, 2022 · 0 comments

Comments

@jwalway
Copy link

jwalway commented Nov 10, 2022

Hello,

I have an issue here.

The goal is to control the Nicla Sense ME (acting as slave) via an Asset Tracker/Samd51 (acting as master) via the I2C bus.

I'm trying your example: "Control Nicla from an arduino board through eslov" seen on this page:
nicla-sense-me-fw

When I run it I don't see any data. I can see nothing in the Arduino IDE serial monitor (unless I plug both of the boards into a COM port).

These are the boards I have:
samd51
MicroMod Asset Tracker Carrier Board
Nicla Sense ME

I used the Arduino IDE 2.0.1 to compile and upload the programs to the boards.

I have the two boards connected by the qwiic connector from the Asset Tracker. The Asset Tracker/Samd51 are powered by a USB cable plugged into my computer. The Nicla Sense ME is powered by the qwiic connector from the Asset Tracker (I checked the connections for power/ground/SDA and SCL with my multimeter).

I compiled and uploaded the App.ino sketch to the Nicla Sense ME (using a COM port). Here is the code:

#include "Arduino.h"
#include "Arduino_BHY2.h"

// Set DEBUG to true in order to enable debug print
#define DEBUG false

void setup()
{
#if DEBUG
  Serial.begin(115200);
  BHY2.debug(Serial);
#endif

  BHY2.begin(NICLA_I2C);
}

void loop()
{
  // Update and then sleep
  BHY2.update(100);
}

And I compiled and uploaded the accelerometer.ino code to the Asset Tracker board. Here is the code:

#include "Arduino.h"
#include "Arduino_BHY2Host.h"

SensorXYZ accel(SENSOR_ID_ACC);

void setup()
{
  // debug port
  Serial.begin(115200);
  while(!Serial);

  BHY2Host.begin();

  accel.begin();
}

void loop()
{
  static auto printTime = millis();
  Serial.println("loop()");
  BHY2Host.update();

  if (millis() - printTime >= 1000) {
    printTime = millis();
    Serial.println(String("Acceleration values: ") + accel.toString());
  }
}

Does anyone have any ideas on this? I'm fairly new to programming devices like this.

Thanks for any help.

Regards,
...John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant