24 lines
719 B
C
24 lines
719 B
C
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
/* Fly the right stick to a position and press its first button. Link bcontrol. */
|
|
#include <Joystick.h>
|
|
|
|
int main(void)
|
|
{
|
|
byte axes[4] = { 0, 0, 0, 0 };
|
|
byte buttons;
|
|
word start;
|
|
printf("MOVE THE RIGHT STICK AND FIRE\n");
|
|
Joystick_disableSound();
|
|
start = getTimer();
|
|
do
|
|
{
|
|
buttons = Joystick_getButtonStates();
|
|
} while ((buttons & 1) && (word) (getTimer() - start) < 600);
|
|
Joystick_getAxisValues(axes, 0x03);
|
|
Joystick_selectAnalogMuxInputs(0);
|
|
Joystick_enableSound();
|
|
printf("RIGHT X=%u Y=%u\n", (unsigned) axes[0], (unsigned) axes[1]);
|
|
printf("BUTTON %s\n", (buttons & 1) ? "UP" : "DOWN");
|
|
return 0;
|
|
}
|