Update on diozero - Java Device I/O library - Raspberry Pi Forums


almost ready 1.0 release, see https://github.com/mattjlewis/diozero details.
getting odd behaviour wiringpi, pi4j , jdk device i/o knocked pigpio jni wrapper library (there 1 partially implemented). preferred provider raspberry pi.
again understand overlap in functionality between , pi4j, in particular new device capabilities in v1.1-snapshot. stated wanted ensure maximum portability across devices present clean object-orientated api similar offered python gpio zero.

usage example:
1. controlling led button

code: select all

try (button b = new button(buttonpin, gpiopullupdown.pull_up); led led = new led(ledpin)) { 	b.whenpressed(led::on); 	b.whenreleased(led::off); 	logger.info("waiting 10s - *** press button connected pin {} ***", integer.valueof(buttonpin)); 	sleeputil.sleepseconds(10); }
2. doing same via mcp23017 gpio expansion board:

code: select all

try (mcp23017 mcp23017 = new mcp23017(intapin, intbpin)) { 	try (button button = new button(mcp23017, inputpin, gpiopullupdown.pull_up); 			led led = new led(mcp23017, outputpin, false, true)) { 		button.whenpressed(led::on); 		button.whenreleased(led::off); 		logger.debug("waiting 10s - *** press button connected mcp23017 pin {} ***", integer.valueof(inputpin)); 		sleeputil.sleepseconds(10); }
feedback welcome.

matt

uploaded snapshot build maven repository - newest addition support mcp30/32/34 adcs ws281x / neopixel leds (via jni wrapper around rpi_ws281x library).
working on documentation @ http://rtd.diozero.com.

matt


raspberrypi



Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code