Skip to main content
3 votes
Accepted

How to correctly identify the pin addresses in the Pi4J 2.2.1 GPIO API?

There are 3 pin numbering conventions in use on the Pi; BCM, Physical (or Board) and WiringPi. BCM is the native numbering (and is the only convention understood by the SoC). Board numbers correspond ...
Milliways's user avatar
  • 60.5k
3 votes

RejectedExecutionException in pi4j

Per the comments below the question, I can't really take the credit for this. jason.keisersmith had received a reply to a bug report posted to the Pi4J Github page here by user savageautomate on 18/03/...
goobering's user avatar
  • 10.7k
3 votes
Accepted

Java and DS18B20

Pi4J has released a 1-Wire API in version 1.1. It's no longer a SNAPSHOT version. W1Master master = new W1Master(); List<W1Device> w1Devices = master.getDevices(TmpDS18B20DeviceType.FAMILY_CODE)...
Simulant's user avatar
  • 653
3 votes

Enabling of I2C-0 via "dtparam=i2c_vc=on" on Pi 3B+ causes "I2C-10" & "I2C-11" to appear and disables GPIO 10 GPIO 11

The documentation states i2c_vc Set to "on" to enable the i2c interface usually reserved for the VideoCore processor ...
Milliways's user avatar
  • 60.5k
3 votes

When to set internal pin resistance at software layer

That is not so good. So the 3.3V power pin from the RPi is connected to the breadboard's top-most rail via a red jumper (note this isn't actually used by the rest of the circuit but I don't believe ...
goldilocks's user avatar
  • 59.3k
2 votes

How to correctly identify the pin addresses in the Pi4J 2.2.1 GPIO API?

Pi4J version 2 uses Broadcom numbering for the GPIO. You should be using 7 (to identify GPIO 7). See https://pinout.xyz/
joan's user avatar
  • 71.2k
2 votes

"Outside Function" issue with code when building a Reverse Park Sensor

In your code, the return command is placed outside the get_distance function. The return command can only be used when it is in a function, so it returns the output of the function you specify. When ...
SkyPlayX's user avatar
  • 312
2 votes

JavaFX on Raspberry PI 3 (Fullscreen/Black Bars)

Fortunately, You don't need to change operating system. You can use gtk2 platform, which works fine on my Raspberry Pi 3. Simply run you Jar application with this command: $JAVA_HOME/bin/java -...
Andy F's user avatar
  • 21
1 vote

Java pi4j app crashes on exit()

I seem to have solved the problem. The problem with the I2C is that the reserved id "my-i2c-bus" can be applied only once to a Pi4J Context. Using a new instance of the Context for each I2C ...
RonH's user avatar
  • 11
1 vote

What can I do to get the Pi4J library to work with Java?

I finally resolved the issue. I am not using Pi4J. I wrote a simple Python script that takes care of the GPIO behavior of the system that I designed and called the script from Java. (I was not about ...
Drewski's user avatar
  • 13
1 vote

PCA9685GpioExample for pi4j 2

Adafruit has a very nice guide on this with some easy to follow instructions. You can find it at" https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi" There are ...
Gil's user avatar
  • 1,238
1 vote
Accepted

Pi4 GPIO Control with Java

Indeed as mentioned in the comments, Pi4J is using a different pin numbering scheme. "Under the hood", WiringPi is used to control the GPIOs. This library uses a different numbering scheme. ...
Frank's user avatar
  • 328
1 vote

Ultrasonic sensor get distance with java

I have written some java classes to use ultrasonic sensor with one of my project. Here it is. PiJavaUltrasonic.java import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio.GpioFactory; ...
chandima's user avatar
1 vote

Rpi4 - double HDMI functionality

The Raspberry Pi is used in a lot of digital signage applications. Double HDMI outputs differentiate the Pi in that market. Think of digital signs in airports, two screens mounted back-to-back. They ...
flakeshake's user avatar
  • 6,213
1 vote
Accepted

My Raspberry Pi B+ has the Ri 2 B pinmap

Looks to me you're mixing up pin numbering schemes. The B+ image above shows BCM (Broadcom) scheme. The second one is the wiringPi (and implicitly Pi4J) scheme (notice the text at the bottom of the ...
Dirk's user avatar
  • 3,541
1 vote

provisionDigitalOutputPin sets mode to high low() and blink() don't work

I presume you want to get this working. I suggest you first find out if the software or the hardware is at fault. With that in mind I suggest the following steps. Remove the wire from wiringPi 7 (...
joan's user avatar
  • 71.2k
1 vote

pi4j implementation for SPI communications with MCP3008 reading zeros

This isn't really an answer, but what I did to get SPI to work. I reformatted my uSD card with a clean installation of Ubuntu Mate 16.04.5, installed wiringPi, the pi4j libraries, and Oracle Java. I ...
mike's user avatar
  • 111
1 vote

pi4j implementation for SPI communications with MCP3008 reading zeros

When using the SPI peripheral, rather than bitbanging it, you have to follow the documentation. On the Raspberry Pi 3, there is one SPI bus, with two (and only two) connections. The pins needed are: ...
NomadMaker's user avatar
  • 1,560
1 vote

When to set internal pin resistance at software layer

When a GPIO set as an input has no definite voltage attached it is said to be floating and will randomly return 0 or 1. The purpose of the internal pull-ups and pull-downs is to stop a GPIO set as an ...
joan's user avatar
  • 71.2k
1 vote
Accepted

GPIO works on PI Model B but does not work on PI 3 Model B

Problem solved. It was the Pi4J version. I migrated to the latest version (1.1) and it worked. Tks!
Chocksmith's user avatar
1 vote

Software Flow Control in Serial communication

You do not need a library written especially for the Raspberry Pi. The major point of standardization and modularization of components, software and hardware, is interchangeability. A serial port is ...
goldilocks's user avatar
  • 59.3k
1 vote

Pi4J ESC brushless motor is not running stable

As mentioned before, indeed Raspbian OS is not real-time so software controlled PWM will never be fully stable. But luckily there is hardware support on specific GPIOs! As it is well described on ...
Frank's user avatar
  • 328
1 vote

How to use PI4J with a brushless motor?

If I understand correctly you want to control a brushless motor which is being driven by an ESC (Kontronik CYBEC 40-6-12). ESCs are controlled in a very similar way to servos. However they often ...
joan's user avatar
  • 71.2k

Only top scored, non community-wiki answers of a minimum length are eligible