final GpioPinDigitalOutput run_pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LEDrun", PinState.LOW);
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput exitButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_07, PinPullResistance.PULL_DOWN);
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
// provision gpio pin #00 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton2 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_00, PinPullResistance.PULL_DOWN);
// provision gpio pin #03 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton3 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_03, PinPullResistance.PULL_DOWN);
// create and register gpio pin listener
myButton2.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
if(event.getState() == PinState.LOW)
{
System.out.println(ANSI_WHITE +"Velocity Test Start" + ANSI_GREEN);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(SerialCommn.class.getName()).log(Level.SEVERE, null, ex);
}
// System.out.println("Velocity");
hs.store("Test",fm.getSeial());
System.out.println(ANSI_WHITE + "000.000mps" + ANSI_GREEN);
}
}
});
// create and register gpio pin listener
myButton.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
long start=0,stop=0;
if(event.getState() == PinState.LOW)
{
if(CheckInternet.testInet("192.168.1.5"))
{
String m = fm.getAddr();
String ser= fm.getSeial();
//System.out.println(ser);
//System.out.println(m);
System.out.println(ANSI_PURPLE +"Register Online");
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(SerialCommn.class.getName()).log(Level.SEVERE, null, ex);
}
//System.out.println("Online...");
RegisterDevice reg = new RegisterDevice();
String s = reg.sendRecord(m +","+ ser);
if(s.equals("false"))
{
System.out.println(ANSI_BLUE +"Device Registered" + ANSI_GREEN);
// System.out.println("Registered");
}
else
{
System.out.println(ANSI_RED +"Already Registered" + ANSI_GREEN);
// System.out.println("Registered");
}
// System.out.println("");
}
else
{
System.out.println(ANSI_RED +"Network Failure");
}
}
}
});
// create and register gpio pin listener
myButton3.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
if(event.getState() == PinState.LOW)