getGyroscopeData, readGyroscopeRange, setGyroscopeRange, extended example
This commit is contained in:
@@ -2,13 +2,25 @@
|
||||
#include <wiringPi.h>
|
||||
#include "libgy521.h"
|
||||
|
||||
|
||||
void printall(void) {
|
||||
printf("---------------------------------------------\n");
|
||||
printf("Accel: x=%i, y=%i, z=%i\n", getAccelerometerData('s', 0), getAccelerometerData('y', 0), getAccelerometerData('z', 0));
|
||||
printf("Accel Range: raw: %i, int: %i\n", readAccelerometerRange(1), readAccelerometerRange(0));
|
||||
printf("Gyro: x=%i, y=%i, z=%i\n", getGyroscopeData('x'), getGyroscopeData('y'), getGyroscopeData('z'));
|
||||
printf("Gyro Range: raw: %i, int: %i\n", readGyroscopeRange(1), readGyroscopeRange(0));
|
||||
printf("---------------------------------------------\n");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
wiringPiSetup();
|
||||
|
||||
setupgy521();
|
||||
|
||||
printall();
|
||||
while (1) {
|
||||
printf("AngleX = %f, AngleY = %f, AngleZ = %f, Temperature = %f\n", getAngleX(), getAngleY(), getAngleZ(), getTemp());
|
||||
//printf("AngleX = %f, AngleY = %f, AngleZ = %f, Temperature = %f\n", getAngleX(), getAngleY(), getAngleZ(), getTemp());
|
||||
//printf("Gyro: x=%i, y=%i, z=%i\n", getGyroscopeData('x'), getGyroscopeData('y'), getGyroscopeData('z'));
|
||||
printall();
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user