Pushed some testing & coding ideas
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="lib" path="/home/janco/Documenten/github/Arcade-controls/pi4j-service.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/janco/Documenten/github/Arcade-controls/pi4j-gpio-extension.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/janco/Documenten/github/Arcade-controls/pi4j-device.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/janco/Documenten/github/Arcade-controls/pi4j-core.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Arcade-controls</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,45 @@
|
|||||||
|
package control;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.pi4j.io.gpio.GpioController;
|
||||||
|
import com.pi4j.io.gpio.GpioFactory;
|
||||||
|
import com.pi4j.io.gpio.GpioPinDigitalInput;
|
||||||
|
import com.pi4j.io.gpio.RaspiPin;
|
||||||
|
|
||||||
|
public class Buttons {
|
||||||
|
private ArrayList<GpioPinDigitalInput> buttons;
|
||||||
|
private final GpioController rpi = GpioFactory.getInstance();
|
||||||
|
/**
|
||||||
|
Pin numbering below *not used yet, just for remembering the pin numbers*
|
||||||
|
*/
|
||||||
|
//arcade buttons
|
||||||
|
private final int button1 = 29;
|
||||||
|
private final int button2 = 28;
|
||||||
|
private final int button3 = 27;
|
||||||
|
private final int button4 = 25;
|
||||||
|
private final int button5 = 24;
|
||||||
|
private final int button6 = 23;
|
||||||
|
//joystick
|
||||||
|
private final int joystickleft = 26;
|
||||||
|
private final int joystickup = 22;
|
||||||
|
private final int joystickright = 21;
|
||||||
|
private final int joystickdown = 11;
|
||||||
|
//start-stop button
|
||||||
|
private final int buttonstart = 10;
|
||||||
|
|
||||||
|
public Buttons(){
|
||||||
|
buttons = new ArrayList<GpioPinDigitalInput>();
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_29 , "button1"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_28 , "button2"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_27 , "button3"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_25 , "button4"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_24 , "button5"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_23 , "button6"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_26 , "joystickleft"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_22 , "joystickup"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_21 , "joystickright"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_11 , "joystickdown"));
|
||||||
|
buttons.add(rpi.provisionDigitalInputPin(RaspiPin.GPIO_10 , "buttonstart"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package control;
|
||||||
|
|
||||||
|
import com.pi4j.io.gpio.GpioController;
|
||||||
|
import com.pi4j.io.gpio.GpioFactory;
|
||||||
|
import com.pi4j.io.gpio.GpioPinDigitalInput;
|
||||||
|
import com.pi4j.io.gpio.RaspiPin;
|
||||||
|
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
|
||||||
|
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
|
||||||
|
|
||||||
|
public class Buttontest{
|
||||||
|
|
||||||
|
final GpioController rpi = GpioFactory.getInstance();
|
||||||
|
public Buttontest(){
|
||||||
|
GpioPinDigitalInput button1 = rpi.provisionDigitalInputPin( RaspiPin.GPIO_07,
|
||||||
|
"button1");
|
||||||
|
button1.addListener(new GpioPinListenerDigital() {
|
||||||
|
@Override
|
||||||
|
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent e){
|
||||||
|
System.out.println(e.getPin());
|
||||||
|
System.out.println(e.getSource());
|
||||||
|
System.out.println(e.getState());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
while(true){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
-1
@@ -1,9 +1,12 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
|
import control.Buttontest;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new Window();
|
// new Window();
|
||||||
|
new Buttontest();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user