my new Nano 33 BLE Sense arrived today. I'm working on a project to send data from the the Nano via an Xbee S2C module to a receiver module connected to a Nano 33 IoT. I had the project working before using an MPU6050 and Mega 2560 board which worked (using Software Serial on the Mega). On the IoT side, I am using 'Uart XBeeRx (&sercom0, 5, 6, SERCOM_RX_PAD_1, UART_TX_PAD_0);' to process the data from the Xbee. Having tried this syntax on the BLE Sense I hit problems and after some Googling found a different syntax. However my new code isn't working in so far as it compiles, uploads and then crashes the BLE Sense (serial port disappears from tools and the onboard LED blinks slowly and erratically). I need to keep resetting the board and suspect there is some issue with my hardware serial implementation. I've cut the code down to simply send accelerometer data. My code is as follows - the EasyTransfer library simplifies the Xbee comms. Any help appreciated!
#include <EasyTransfer.h>
#include <Arduino_LSM9DS1.h>
UART XBeeTx (digitalPinToPinName(6), digitalPinToPinName(5), NC, NC);
EasyTransfer ET;
struct SEND_DATA_STRUCTURE {
float xAcc;
float yAcc;
float zAcc;
};
SEND_DATA_STRUCTURE myData;
// ================================================================
// === INITIAL SETUP ===
// ================================================================
void setup() {
XBeeTx.begin(9600);
ET.begin(details(myData), &XBeeTx);
}
// ================================================================
// === MAIN PROGRAM LOOP ===
// ================================================================
void loop() {
float x, y, z;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
}
myData.xAcc = x;
myData.yAcc = y;
myData.zAcc = z;
ET.sendData();
}