Kiihtyvyysanturin käyttöönotto

Tämän esimerkin avulla saat näkyviin robotin kiihtyvyyden kolmella eri akselilla (X, Y, Z).

#pragma config(Sensor, S1,     ACCELOMETER,           sensorI2CCustom)


#include "drivers/HTAC-driver.h" // download and include drivers

task main () {
  int x_axis = 0;
  int y_axis = 0;
  int z_axis = 0;

  while (true) {
    eraseDisplay();

    // Read all of the axes at once
     HTACreadAllAxes(ACCELOMETER, x_axis, y_axis, z_axis);

    wait1Msec(100);
  }
}
  • No labels
You must log in to comment.