task main(){

  short heading;
  short x_val, y_val, z_val;      // axis values

  displayCenteredTextLine(0, "Mindsensors");
  displayCenteredBigTextLine(1, "IMU");
  displayCenteredTextLine(3, "Test 2");
  displayCenteredTextLine(5, "Connect sensor");
  displayCenteredTextLine(6, "to S1");
  sleep(2000);
  eraseDisplay();

  while (true){

    // Read the Compass
    heading = MSIMUreadHeading(MSIMU);

    displayTextLine(1, "%d", heading);

    // Read the tilt
    MSIMUreadTiltAxes(MSIMU, x_val, y_val, z_val);

    displayTextLine(5, "%d", x_val);
    displayTextLine(6, "%d", y_val);
    displayTextLine(7, "%d", z_val);
    sleep(50);
  }
}
Example #2
0
task main()
{
	clearDebugStream();
	writeDebugStreamLine("xbee5");

	time1[T1] = 0;

	nxtEnableHSPort();            //Enable High Speed Port #4
	nxtSetHSBaudRate(115200);  			//Xbee Default Speed
	nxtHS_Mode = hsRawMode;       //Set to Raw Mode (vs. Master/Slave Mode)

	while (true)
	{
		int t = time1[T1];
		int ax, ay, az, tx, ty, tz, gx, gy, gz;

		MSIMUreadAccelAxes(AIMU, ax, ay, az);
		MSIMUreadTiltAxes(AIMU, tx, ty, tz);
		MSIMUreadGyroAxes(AIMU, gx, gy, gz);

		dataLog(7, t, (az / 100.0));
		dataLog(8, t, (tz / 1000.0));
		dataLog(9, t, gz);

		wait1Msec(50);
	}

}