org.kjkoster:lego-wedo-java

A Java library for LEGO WeDo and for Vengit SBrick and SBrick Plus.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

org.kjkoster
Идентификатор

Идентификатор

lego-wedo-java
Последняя версия

Последняя версия

2.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

org.kjkoster:lego-wedo-java
A Java library for LEGO WeDo and for Vengit SBrick and SBrick Plus.
Ссылка на сайт

Ссылка на сайт

https://github.com/kjkoster/lego-wedo-java
Система контроля версий

Система контроля версий

https://github.com/kjkoster/lego-wedo-java

Скачать lego-wedo-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.kjkoster/lego-wedo-java/ -->
<dependency>
    <groupId>org.kjkoster</groupId>
    <artifactId>lego-wedo-java</artifactId>
    <version>2.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.kjkoster/lego-wedo-java/
implementation 'org.kjkoster:lego-wedo-java:2.2'
// https://jarcasting.com/artifacts/org.kjkoster/lego-wedo-java/
implementation ("org.kjkoster:lego-wedo-java:2.2")
'org.kjkoster:lego-wedo-java:jar:2.2'
<dependency org="org.kjkoster" name="lego-wedo-java" rev="2.2">
  <artifact name="lego-wedo-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.kjkoster', module='lego-wedo-java', version='2.2')
)
libraryDependencies += "org.kjkoster" % "lego-wedo-java" % "2.2"
[org.kjkoster/lego-wedo-java "2.2"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
com.codeminders : hidapi jar 1.1
com.google.guava : guava jar 21.0
org.projectlombok : lombok jar 1.16.16
org.thingml » bglib-protocol-1.0.3-43 jar 1.2.1-SNAPSHOT
commons-cli : commons-cli jar 1.4
com.fazecast : jSerialComm jar 1.3.11

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

lego-wedo-java

A Java library for LEGO WeDo and for Vengit SBrick and SBrick Plus. It also comes with simple command line utilities to test controlling LEGO WeDo hubs and SBricks from the command line.

Getting Started

Getting started with LEGO WeDo is described here on the lego-wedo-java USB WeDo Wiki.

BLE112 Bluetooth Dongle Permissions Under Linux

By default, the BLE112 Bluetooth dongle is only readable by root and not by regular users.

To grant non-root users to access the BLE112 dongle, create a file named /etc/udev/rules.d/ble112.rules with the following incantation:

ATTRS{idVendor}=="2458", ATTRS{idProduct}=="0001", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666"

Then unplug the Bluetooth dongle and plug it back in. You should now be able to address it.

Playing Sound Clips

Playing sound clips are easy from the original LEGO WeDo software and I have to say it adds a lot to the build, silly as it may seem. Adding sound clips proved both more hard and more easy than I thought.

It is hard to add sound clips because of the rights to the various clip files. Obviously I cannot publish the original LEGO WeDo sounds. Making my own sounds is also not very successful (ahem).

On the other hand, playing a sound clip in Java is really easy.

final File file = new File(fileName);
if (file.exists()) {
    final AudioInputStream sound = AudioSystem.getAudioInputStream(file);
    final Clip clip = AudioSystem.getClip();
    clip.open(sound);
    
    clip.start();
    clip.drain();
    clip.stop();
} else {
    throw new IOException(file + " does not exist");
}

That is all. I thought to add it to the WeDoBricks class, but that would just hide the controls for you. So here it is. I'm not adding sound support to this WeDo library, simply because Java already makes that super easy.

Reference

Версии библиотеки

Версия
2.2
2.1
2.0