Search in sources :

Example 1 with DCMotorOutputChannel

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

the class DCMotorTest method main.

public static void main(String[] args) throws InterruptedException {
    DyIO dyio = new DyIO();
    if (!ConnectionDialog.getBowlerDevice(dyio)) {
        System.exit(1);
    }
    DCMotorOutputChannel dc = new DCMotorOutputChannel(dyio.getChannel(4));
    // Loop 10 times setting the dc output
    float time = 5;
    for (int i = 0; i < 10; i++) {
        System.out.println("Moving.");
        // Set the velocity from off to full
        int pos = ((i % 2 == 0) ? 128 : 0);
        dc.setValue(pos);
        // pause between cycles so that the changes are visible
        Thread.sleep((long) (time * 1000));
    }
    dyio.disconnect();
    System.exit(0);
}
Also used : DyIO(com.neuronrobotics.sdk.dyio.DyIO) DCMotorOutputChannel(com.neuronrobotics.sdk.dyio.peripherals.DCMotorOutputChannel)

Aggregations

DyIO (com.neuronrobotics.sdk.dyio.DyIO)1 DCMotorOutputChannel (com.neuronrobotics.sdk.dyio.peripherals.DCMotorOutputChannel)1