Read the gyrometer data and print it to the terminal
cmake_minimum_required(VERSION 3.3)
project(L3G_Demo)
create_simple_executable(${PROJECT_NAME} L3G_Demo.cpp)
const uint32_t
FREQ = 10000;
void error (const PropWare::ErrorCode err);
int16_t gyroValues[3];
gyro.start();
gyro.always_set_spi_mode(1);
while (1) {
gyro.read_all(gyroValues);
waitcnt(50*MILLISECOND + CNT);
}
return 0;
}
void error (const PropWare::ErrorCode err) {
while (1) {
debugLEDs.write((uint32_t) err);
waitcnt(CLKFREQ / 5 + CNT);
debugLEDs.write(0);
waitcnt(CLKFREQ / 5 + CNT);
}
}