![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Example of usb mouse on smt32 platform using a analog 2-axis joystick
Diff: main.cpp
- Revision:
- 6:989396ea046f
- Parent:
- 5:b3c465e3e54e
- Child:
- 7:bb9d609a8493
--- a/main.cpp Sat Apr 29 11:53:58 2017 +0000 +++ b/main.cpp Sat Apr 29 19:23:34 2017 +0000 @@ -7,7 +7,13 @@ USBMouse mouse(ABS_MOUSE); DigitalOut myled(LED1); +BusIn joy(PA_13, PA_14); +DigitalIn click(PB_7); + +Serial mipc(USBTX, USBRX); + int main(void) { + mipc.printf("HOLA"); int x_center = (X_MAX_ABS - X_MIN_ABS)/2; int y_center = (Y_MAX_ABS - Y_MIN_ABS)/2; int16_t x_screen = 0; @@ -20,6 +26,7 @@ int32_t angle = 0; while (1) { + mipc.printf("PALANCA %d, BOTON %d\r", joy.read(), click); myled = !myled; x_screen = x_origin + cos((double)angle*3.14/180.0)*radius; y_screen = y_origin + sin((double)angle*3.14/180.0)*radius;