I've got an Adafruit Bluefruit NRF52 hooked up to the Adafruit BNO055 9-axis orientation sensor, but when I use Serial.write to send the data, serial monitor displays blank values only. The scroll bar drops so something I definitely appearing, it just seems to be empty.
Serial.print works fine, but I cannot use this for my application, as it uses too much memory.
I'm gathering 3 axis of absolute orientation plus 3 axis of acceleration (6 floats in total) plus a three digit number representing the calibration of each sensor.
Each line should look something like
303 68.69 4.19 -2.19 -0.12 0.14 -0.40
My code:
void displayCalStatus(void)
{
uint8_t system, gyro, accel, mag;
system = gyro = accel = mag = 0;
bno.getCalibration(&system, &gyro, &accel, &mag);
/* Display the individual values */
Serial.write(gyro);
Serial.write(accel);
Serial.write(mag);
Serial.write("\t");
}
void loop()
{
imu::Vector<3> accel = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);
displayCalStatus();
/* Display the floating point data */
Serial.write(event.orientation.x);
Serial.write("\t");
Serial.write(event.orientation.y);
Serial.write("\t");
Serial.write(event.orientation.z);
Serial.write("\t");
/* Display the floating point data for Linear Acceleration */
Serial.write(accel.x());
Serial.write("\t");
Serial.write(accel.y());
Serial.write("\t");
Serial.write(accel.z());
Serial.write("\n");
}
write
transfers a byte, you wantprint
text. replace allwrite
withprint
– Juraj Jan 9 '19 at 18:53system = gyro = accel = mag = 0;
Instead, explicitly set each one to zero. – jose can u c Jan 9 '19 at 18:58