Search in sources :

Example 1 with DigitalOutputChannel

use of com.neuronrobotics.sdk.dyio.peripherals.DigitalOutputChannel in project java-bowler by NeuronRobotics.

the class DIgitalOutputTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    Log.enableInfoPrint();
    DyIO.disableFWCheck();
    DyIO dyio = new DyIO();
    if (!ConnectionDialog.getBowlerDevice(dyio)) {
        System.exit(1);
    }
    DigitalInputChannel dic = new DigitalInputChannel(dyio.getChannel(1));
    DigitalOutputChannel doc = new DigitalOutputChannel(dyio.getChannel(1));
    // Blink the LED 5 times
    for (int i = 0; i < 10; i++) {
        System.out.println("Blinking.");
        // Set the value high every other time, exit if unsuccessful
        if (!doc.setHigh(i % 2 == 1)) {
            System.err.println("Could not connect to the device.");
            System.exit(0);
        }
        // pause between cycles so that the changes are visible
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    System.exit(0);
}
Also used : DigitalInputChannel(com.neuronrobotics.sdk.dyio.peripherals.DigitalInputChannel) DigitalOutputChannel(com.neuronrobotics.sdk.dyio.peripherals.DigitalOutputChannel) DyIO(com.neuronrobotics.sdk.dyio.DyIO)

Aggregations

DyIO (com.neuronrobotics.sdk.dyio.DyIO)1 DigitalInputChannel (com.neuronrobotics.sdk.dyio.peripherals.DigitalInputChannel)1 DigitalOutputChannel (com.neuronrobotics.sdk.dyio.peripherals.DigitalOutputChannel)1