Search in sources :

Example 1 with DataListener

use of com.robo4j.hw.rpi.imu.bno.DataListener in project robo4j by Robo4J.

the class Bno080AccelerometerExample method main.

public static void main(String[] args) throws Exception {
    DataListener listener = (DataEvent3f event) -> System.out.println("ShtpPacketResponse: " + event);
    System.out.println("BNO080 SPI Accelerometer Example");
    // Change here to use other modes of communication
    Bno080Device device = Bno080Factory.createDefaultSPIDevice();
    device.addListener(listener);
    device.start(SensorReportId.ACCELEROMETER, 100);
    System.out.println("Press <Enter> to quit!");
    System.in.read();
    device.shutdown();
}
Also used : Bno080Device(com.robo4j.hw.rpi.imu.bno.Bno080Device) DataEvent3f(com.robo4j.hw.rpi.imu.bno.DataEvent3f) DataListener(com.robo4j.hw.rpi.imu.bno.DataListener)

Example 2 with DataListener

use of com.robo4j.hw.rpi.imu.bno.DataListener in project robo4j by Robo4J.

the class Bno080Example method main.

public static void main(String[] args) throws Exception {
    DataListener listener = (DataEvent3f event) -> System.out.println("ShtpPacketResponse: " + event);
    System.out.println("BNO080 SPI Rotation Vector Example");
    // Change here to use other modes of communication
    Bno080Device device = Bno080Factory.createDefaultSPIDevice();
    device.addListener(listener);
    device.start(SensorReportId.ROTATION_VECTOR, 1000);
    System.out.println("Press <Enter> to quit!");
    System.in.read();
    device.shutdown();
}
Also used : Bno080Device(com.robo4j.hw.rpi.imu.bno.Bno080Device) DataEvent3f(com.robo4j.hw.rpi.imu.bno.DataEvent3f) DataListener(com.robo4j.hw.rpi.imu.bno.DataListener)

Aggregations

Bno080Device (com.robo4j.hw.rpi.imu.bno.Bno080Device)2 DataEvent3f (com.robo4j.hw.rpi.imu.bno.DataEvent3f)2 DataListener (com.robo4j.hw.rpi.imu.bno.DataListener)2