How do I initialize my Arduino 101? CurieIMU sensors


I am making a system with an arduino 101 and an android smartphone. I want to be able to initialize the arduino sketch using a button click on the android app. Bluetooth is working fine.. But how do I initialize the arduino sensors? Meaning setting values to zero, like it is done when starting the sketch.

Here is my code where I get the orientation of the board in degrees. Degrees start in zero and change as moving the board. I want to be able to set the degrees to zero again.. I guess you know what I mean :slight_smile:

ax = CurieIMU.getAccelerationX();
ay = CurieIMU.getAccelerationY();
az = CurieIMU.getAccelerationZ();
gx = CurieIMU.getRotationX();
gy = CurieIMU.getRotationY();
gz = CurieIMU.getRotationZ();

filter.updateIMU(gx / factor, gy / factor, gz / factor, ax, ay, az);

yaw = filter.getYaw();
roll = filter.getRoll();
pitch = filter.getPitch();

x_value = ((yaw * 180.0 / M_PI)/2);
y_value = ((roll * 180.0 / M_PI)/2);
z_value = ((pitch * 180.0 / M_PI)/2);

I guess you know what I mean

You guessed wrong.

When I start/upload the sketch the yaw/roll/pitch values are all zero. After moving the arduino, these changes. - How do I get them to zero again? Like, initializing the arduino/sketch again?