task main(){ int x_val, y_val, z_val; // axis values nxtDisplayCenteredTextLine(0, "Mindsensors"); nxtDisplayCenteredBigTextLine(1, "IMU"); nxtDisplayCenteredTextLine(3, "Test 1"); nxtDisplayCenteredTextLine(5, "Connect sensor"); nxtDisplayCenteredTextLine(6, "to S1"); wait1Msec(2000); eraseDisplay(); while (true){ // Read the GYROSCOPE MSIMUreadGyroAxes(MSIMU, x_val, y_val, z_val); nxtDisplayTextLine(1, "%d", x_val); nxtDisplayTextLine(2, "%d", y_val); nxtDisplayTextLine(3, "%d", z_val); // Read the accelerometer MSIMUreadAccelAxes(MSIMU, x_val, y_val, z_val); nxtDisplayTextLine(5, "%d", x_val); nxtDisplayTextLine(6, "%d", y_val); nxtDisplayTextLine(7, "%d", z_val); wait1Msec(50); } }
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); } }
task main(){ int x_val, y_val, z_val; // axis values float x_fval, y_fval, z_fval; // axis values nxtDisplayCenteredTextLine(0, "Mindsensors"); nxtDisplayCenteredBigTextLine(1, "IMU"); nxtDisplayCenteredTextLine(3, "Test 1"); nxtDisplayCenteredTextLine(5, "Connect sensor"); nxtDisplayCenteredTextLine(6, "to S1"); wait1Msec(2000); eraseDisplay(); /* * Range 1: Change Accelerometer Sensitivity to 2G and Gyro to 250 degrees/sec * Range 2: Change Accelerometer Sensitivity to 4G and Gyro to 500 degrees/sec * Range 3: Change Accelerometer Sensitivity to 8G and Gyro to 2000 degrees/sec * Range 4: Change Accelerometer Sensitivity to 16G and Gyro to 2000 degrees/sec */ MSIMUsetRange(MSIMU, MSIMU_SENSITIVITY_RANGE_1); while (true){ // Read the GYROSCOPE MSIMUreadGyroAxes(MSIMU, x_fval, y_fval, z_fval); nxtDisplayTextLine(1, "%.2f", x_fval); nxtDisplayTextLine(2, "%.2f", y_fval); nxtDisplayTextLine(3, "%.2f", z_fval); // Read the accelerometer MSIMUreadAccelAxes(MSIMU, x_val, y_val, z_val); nxtDisplayTextLine(5, "%d", x_val); nxtDisplayTextLine(6, "%d", y_val); nxtDisplayTextLine(7, "%d", z_val); wait1Msec(50); } }