游戏试玩效果
原材料
材料1:Fundiuno joystick shield,请自行搜索,价格基本上几块钱。
材料2:STM32最小系统板,也请自行搜索
接线
joystick接线方法如下:
stm32接线方法:
//Funduino joystick 所用到的所有IO定义如下
/*
PA0 Y (模拟) 2路ADC
PA1 X (模拟)
PA2 A 6个按钮
PA3 B
PA4 C
PA5 D
PA6 E
PA7 F
PB0 K 1个按钮当Z轴
*/
#define BTN1_Pin GPIO_PIN_2
#define BTN1_GPIO_Port GPIOA
#define BTN2_Pin GPIO_PIN_3
#define BTN2_GPIO_Port GPIOA
#define BTN3_Pin GPIO_PIN_4
#define BTN3_GPIO_Port GPIOA
#define BTN4_Pin GPIO_PIN_5
#define BTN4_GPIO_Port GPIOA
#define BTN5_Pin GPIO_PIN_6
#define BTN5_GPIO_Port GPIOA
#define BTN6_Pin GPIO_PIN_7
#define BTN6_GPIO_Port GPIOA
//6个按钮定义完成
//K键=Z
#define BTNK_Pin GPIO_PIN_0
#define BTNK_GPIO_Port GPIOB
接线实物
joystick端:
stm32端:
程序源码
程序来源于github, 这是原版:https://github.com/vostrenkov/EazyJoy