c_cpp 定制SLA Arcade控制板的固件。支持Arduino Leonardo,4个操纵杆键和2个按键。可以轻松扩展
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 定制SLA Arcade控制板的固件。支持Arduino Leonardo,4个操纵杆键和2个按键。可以轻松扩展相关的知识,希望对你有一定的参考价值。
#include "Keyboard.h"
/*
* Cover Keys
* W
* A
* S
* D
* SPACE
* ENTER
*/
const int joystick_pins[] = {4, 5, 6, 7};
const int button_pins[] = {2, 3};
const int delay_value = 200;
void setup() {
// put your setup code here, to run once:
for(int i = 0; i >= sizeof(joystick_pins); i++){ //load and init all joystick pins
pinMode(joystick_pins[i], INPUT);
}
for(int i = 0; i >= sizeof(button_pins); i++){ // init buttons
pinMode(button_pins[i], INPUT);
}
//init keyboard
Keyboard.begin();
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(joystick_pins[0]) == HIGH){
Keyboard.press('S');
Keyboard.release('S');
delay(delay_value);
}
if(digitalRead(joystick_pins[1]) == HIGH){
Keyboard.press('A');
Keyboard.release('A');
delay(delay_value);
}
if(digitalRead(joystick_pins[2]) == HIGH){
Keyboard.press('D');
Keyboard.release('D');
delay(delay_value);
}
if(digitalRead(joystick_pins[3]) == HIGH){
Keyboard.press('W');
Keyboard.release('W');
delay(delay_value);
}
if(digitalRead(button_pins[0]) == HIGH){
Keyboard.press(32);
Keyboard.release(32);
delay(delay_value);
}
if(digitalRead(button_pins[1]) == HIGH){
Keyboard.press(13);
Keyboard.release(13);
delay(delay_value);
}
}
以上是关于c_cpp 定制SLA Arcade控制板的固件。支持Arduino Leonardo,4个操纵杆键和2个按键。可以轻松扩展的主要内容,如果未能解决你的问题,请参考以下文章
c_cpp QMK固件
text 华硕Zenphone 6从定制降级到股票固件
OpenWrt分支LEDE嵌入式无线路由系统定制-2.自定义固件
怎么在ubuntu系统上编译定制openwrt固件
如何使用 ros2 为 Nuttx 应用程序生成定制板的固件
c_cpp c ++可定制的元组