Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int32_t recentData[2];
- acc_gyro->get_g_axes(axes);
- recentData[0] = axes[0];
- recentData[1] = axes[1];
- while (true){
- acc_gyro->get_g_axes(axes);
- xDiff = axes[0]-recentData[0];
- if (xDiff > 100){
- joyX++;
- }
- else if (xDiff < -100){
- joyX--;
- }
- yDiff = axes[1]-recentData[1];
- if (yDiff < -2){
- joyY--;
- }
- else if (yDiff > 2){
- joyY++;
- }
- printf("Joystick x und y Ausgabe: %d, %d.\r\n", joyX, joyY);
- recentData[0] = axes[0];
- recentData[1] = axes[1];}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement