Questions tagged [pi4j]

Pi4J is a library for Java to use the GPIOs of the Raspberry Pi.

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 views

Cannot get WS28xx strip code working in eclipse swing

Hey all I have been looking at doing this for some time now. I ran across this posting and this is the type of led strip I am using. However, using that code seems to have errors when trying to add it ...
StealthRT's user avatar
  • 121
2 votes
2 answers
215 views

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

I can't seem to get the right pin number. Let's say I want to access this pin: What's the actual address of the pin? 11, 26 or what? Here's the code I use: (THIS CODE WORKS WITH PIN BCM 23) final ...
MomoTheDev's user avatar
0 votes
2 answers
58 views

Java pi4j app crashes on exit() [closed]

My java app runs fine until I execute a System.exit(). I'm using pi4j/pigpio-2.2.1 on a Pi4b with latest raspian OS. I use DigitalOutput to define my own DigitalOutputPin and I2C for some Sparkfun ...
RonH's user avatar
  • 11
0 votes
1 answer
64 views

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

I am trying to get the Pi4J library to work on my Raspberry Pi 4. I just wrote a simple blink program. It is not toggling the pin as it should be. Here is the simple program. I have compiled it, and ...
Andrew's user avatar
  • 9
0 votes
1 answer
123 views

PCA9685GpioExample for pi4j 2

I want to use THIS sample in my project. But its library is for pi4j version 1 and I use the pi4j version 2. I searched and I didn't find any sample for PCA9685 with pi4j2. Is there anyone who can ...
Reza Gholipour's user avatar
0 votes
0 answers
138 views

Raspberry 4 Java Pi4J GPIO Input not changing state

I am trying to use my Raspberry Pi 4's GPIOs to turn on various thing in my smart home. I am getting 2.6V on the GPIO Input, thus resulting in a HIGH signal. I have confirmed this with a basic python ...
Dahlin's user avatar
  • 1
1 vote
1 answer
97 views

ServoMotor I2C module

I want to control a ServoMotor with THIS module: I asked a question before in THIS topic. And as you can see in the topic, they guided me perfectly. And they said I should use THIS code. But I have a ...
Reza Gholipour's user avatar
0 votes
0 answers
128 views

Turn on LED using pi4j and Raspberry pi 4

I am so new to Raspberry Pi. I want to use pi4j 2 to flash a led that is connected to a raspberry pi. This is my code but the led does not turn on at all: import com.pi4j.Pi4J; import com.pi4j.io.gpio....
Reza Gholipour's user avatar
1 vote
1 answer
374 views

/dev/i2c is not showing Raspberry Pi4 running on Android

I am using AOSP android 11 in the RPi4. I have enabled the i2c in config.txt using the param dtparam=i2c_arm=on. The i2c is showing in the /sys/bus/i2c/devices/i2c-1 but /dev/i2c is not listing in the ...
Jijith Janardanan's user avatar
0 votes
3 answers
260 views

why doesn't spi1 in pi4j work?

I'm trying to connect raspberry with another pcb via spi. It is connected via spi1 port and I can't change it. So I have a python script that works well, so I can send and receive data. The python ...
crackanddie's user avatar
0 votes
1 answer
163 views

GpioPinPwmOutput set pwm value with floating point

I have a raspberry pi 4 B and I want to control servo motor. I am using NetBeans IDE and Java programming language with pi4j library for raspberry. Also I have a servo motor that can rotate for 300 ...
crackanddie's user avatar
0 votes
0 answers
129 views

Pi4 MCP3008 - SPI port setup failed, no SPI available

I am trying to use a joystick with a MCP3008 in the middle (Connected to GPIO8 - SPI CS0) but I get following error: Exception in thread "main" java.lang.reflect.InvocationTargetException ...
osumatu's user avatar
  • 113
0 votes
0 answers
71 views

Raspberry PI and 8 module relay board

I have a raspberry pi 2 and an 8 module relay board (http://nettop.gr/index.php/en/hlektronika/relay/8-channel-5v-relay-module-with-light-coupling-5v.html). Between the relay board and the raspberry I ...
Investigator's user avatar
1 vote
2 answers
2k views

Pi4 GPIO Control with Java

I am basically trying to turn on a led by using pi4j library. My code is pretty simple: public static void main(String args[]) throws InterruptedException { GpioController gpioController = ...
osumatu's user avatar
  • 113
3 votes
1 answer
5k views

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

For reference: I am using the latest release Pi OS Lite, Aug 2020 version. I am developing an application using Pi4J. I am referring to pins via this Pinout: Pin Numbering - Raspberry Pi 3B+ I am ...
MountainPi's user avatar
2 votes
1 answer
423 views

Rasberry Pi 3 Pi4j does not work for digital pins other than RaspiPin.GPIO_07

I am trying to get a led working with the Raspberry Pin 3 model B+ with Raspbian. I am using Java Pi4j library this way: GpioPinDigitalOutput digitalOutputPin = GpioFactory.getInstance()....
MABC's user avatar
  • 123
-1 votes
1 answer
54 views

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

I am using a Pi 4 to build a reverse park sensor based on these tutorials: https://forum.core-electronics.com.au/t/raspi-parking-sensor/3736/6 https://www.instructables.com/id/Raspberry-Pi-Park-...
BND 's user avatar
  • 1
2 votes
0 answers
458 views

How Can I read data from AD8361 RF Detector

I want to check if my microwave has a leakage. I figured out that I can use AD8361 module as an rf power meter. The question is how can I connect raspberry pi to ad8361 and how can I read the output ...
Davithbul's user avatar
0 votes
0 answers
368 views

Can't read data from PN532 NFC reader over SPI

I'm using Pi4J library to read data from a NFC reader based on PN532, connected to my Pi via SPI. However, I don't seem to receive any data from if when I put a NFC card to my reader. I'm using SPI0 ...
mag_zbc's user avatar
  • 121
0 votes
0 answers
37 views

pi4j opposite state in java, normal in python

I have a Raspberry Pi 3B+ and switches (jqc3f-05vdc-c). When I run simple program on python like this: [...] GPIO.setup(18, GPIO.OUT) GPIO.output(18, 0) [...] my sweatch is off, on when i set GPIO....
Kuba K's user avatar
  • 1
1 vote
1 answer
1k views

Rpi4 - double HDMI functionality

What is the rational ( or what are the advantages ) of having a double HDMI port on the Raspberri Pi 4. Since the Pi is new, I did not find any info around and still did not tested myself- but What ...
Obmerk Kronen's user avatar
0 votes
0 answers
228 views

Pi4j Edge detection does not work (always detects both edges)

I am new to using Raspberry Pis GPIO and I am using pi4j to control it. I simply tried to make a Button work, that only triggers when releasing the button. Here is my code if (Gpio....
user84037's user avatar
0 votes
0 answers
155 views

BTS7960 pwm values

I have a BTS7960 h-bridge and I am trying to make a motor to move forward and backward using pwm values. I am using the pi4j library to control the pins. The pins L_EN and R_EN are initialized as ...
LiTTle's user avatar
  • 123
0 votes
1 answer
76 views

My Raspberry Pi B+ has the Ri 2 B pinmap

I trying out different java programs for my RPi B+ V1.2 and as far I have only tried to blink with a lamp for a few seconds. It works. Now I want to try to blink with a lamp by using a button. In ...
euraad's user avatar
  • 105
-1 votes
1 answer
472 views

How to restart the GPIO after shutdown() called

After I call the following Java code: gpio.shutdown() The GPIO turns off. How can I restart it? I need to restart it because of this problem. In the problem the light does not turn off with led.low(...
Heng Ye's user avatar
  • 101
0 votes
4 answers
579 views

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

I have the following Java program to turn off the LED connected to wiringpi GPIO_07 at start, then blink based on user input. import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio....
Heng Ye's user avatar
  • 101
2 votes
0 answers
350 views

PI4J + Adafruit LCD with MCP23017

Got this device. Python example char_lcd_plate.py is working perfect. But I would like to manage it with Pi4J. I copied bits from python example LCD_PLATE_RS = 15 LCD_PLATE_RW ...
Alex's user avatar
  • 71
0 votes
0 answers
112 views

Raspberry Pi piface pi4j java

I am new to Raspberry Pi and am trying to use pi4j library to run one of the java samples of pi4j provided. When I issue gpio commandline on my pi, I am able to set the output high or low on the ...
SoftwareDveloper's user avatar
1 vote
2 answers
774 views

pi4j implementation for SPI communications with MCP3008 reading zeros

I have hardwired a MCP3008 IC into the SPI input on a Raspberry Pi3. MCP3008 is wired as follows: pin 10 (CS) to Pi GPIO_10 (pin 24) this is CE0 pin 11 (Din) to Pi GPIO_12 (pin 19) this is MOSI ...
mike's user avatar
  • 111
0 votes
0 answers
136 views

GPIO listener on Compute module 3 Pi4J

I am doing a project where I use a compute module 3 with Raspbian Jessi Lite, Java with the Pi4J lib version 1.2-SNAPSHOT. I'm trying to implement a GpioPinListenerDigital on the GPIO_23 like so: ...
lucblender's user avatar
1 vote
1 answer
1k views

JavaFX on Raspberry PI 3 (Fullscreen/Black Bars)

I have Raspbian installed on my Pi 3. I am trying to develop a JavaFX application which needs to send and receive data over serial interface so I use PI4J. Now i have a few problems when running this ...
D. Programmer's user avatar
0 votes
2 answers
610 views

When to set internal pin resistance at software layer

I'm trying to wire my Raspbery Pi 1 Model A (hereafter RPi) to a simple 6VDC buzzer and here is my best attempt: So the 3.3V power pin from the RPi is connected to the breadboard's top-most rail via ...
smeeb's user avatar
  • 635
0 votes
0 answers
283 views

cannot play sounds on RPI3-B with java

im creating a java game library with support for raspberry, on that library I have a class that is in charge of sound effects, I created a game to test GPIO pins and sound was not working, I got an ...
Pavul Zavala's user avatar
-1 votes
1 answer
717 views

Pi4J | SPI | Gpio-Pin as Chip Select

I am using Pi4J to write programs on my Raspberry Pi. The Raspi is supposed to communicate with an Arduino Uno via SPI. It works pretty good, but there are only two SpiChannels so there are also only ...
D. Programmer's user avatar
6 votes
2 answers
412 views

Pi4J kills USB bus?

Hello fellow Pi enthusiasts :) I am currently attempting to control a standard 16x2 character LCD display from the PI's GPIO pins from Java. I downloaded Pi4J and wrote a small program to initialize ...
You'reAGitForNotUsingGit's user avatar
0 votes
1 answer
204 views

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

Something very unusual is happening here. I wrote a program in Java (using Pi4J) to blink a led (to debug the problem). testPin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01,"TEST",PinState.HIGH)...
Chocksmith's user avatar
1 vote
0 answers
602 views

GPIO State Listener Example using Pi4J permanently triggers LOW-event

I have a Pi3 and I am trying out the example http://pi4j.com/example/listener.html which is a GPIO state listener. My issue is the following: When I press (close) the contact, I get one HIGH event. ...
yglodt's user avatar
  • 347
1 vote
2 answers
1k views

Software Flow Control in Serial communication

I am using java/pi4j to for serial port in raspberry pi (Raspbian OS) to connect it to a device which has serial port. I am wondering is it possible to use software flow control (xonxoff) in my ...
Ali Khalili's user avatar
0 votes
3 answers
476 views

Pi4J ESC brushless motor is not running stable

I would like to control a brushless motor with a Java program running on a Raspberry Pi model b+. This is the code that I am using: package de.ye.boat_eng; import com.pi4j.wiringpi.Gpio; import com....
cy8berpunk's user avatar
2 votes
1 answer
561 views

How to use PI4J with a brushless motor?

I have a Raspberry Pi 2 model B. I would like to be able to control a motor with a regulator and PI4J. I put the black cable to a ground pin and the PWM pin to pin 26. I've worked with servos before, ...
cy8berpunk's user avatar
3 votes
2 answers
461 views

RejectedExecutionException in pi4j

I have a Java program that is using pi4j project to interact with the GPIOs. I have one test class that listens for a button to be pressed and then does something. The class is part of many in a ...
jason.kaisersmith's user avatar
3 votes
0 answers
2k views

Pi4J and Mifare RC-522 via SPI

I am having problems with coding a program that allows me to read RFID Tags with Pi4J on my Raspberry Pi 2 Model B. I am totally new to Python and would prefer a program written in Java to save some ...
Nico Enking's user avatar
3 votes
2 answers
6k views

Java and DS18B20

I want to read temperature from DS18B20 sensors. Sensors are connected and works fine. How can I read temperature using Pi4J? Is there API for this?
mariusz2108's user avatar
2 votes
1 answer
416 views

Output Accurate, Detailed PWM signal

I'm building a quadcopter using the RPI 2 Model B. I'm currently using the Pi4J library (Java library that wraps the WiringPi library) for my project. All is going well except my ESC (Electronic Speed ...
Peter Zhu's user avatar
  • 278
3 votes
1 answer
297 views

Why is my LED display code so slow?

I have a Raspberry Pi 2 and I am trying to create an led display for it from scratch. It works.. but the refresh is far to slow. My project is running very very slow averaging around 21 ms per ...
Hailey Upchurch's user avatar
24 votes
1 answer
32k views

Do all GPIO pins have a internal pull-up/pull-down resistors?

So question is: Does all Raspberrys GPIO have a internal pull-up/pull-down resistor which can be enabled from program, in my case Java language with PiJ4? I have Raspberry Model B+.
Redex's user avatar
  • 479
1 vote
1 answer
968 views

Java Servlets and Raspberry Pi IO

I'm trying to learn how to write simple servlets to use with a Raspberry Pi. I want to control the board I/O via web.I'm using the Pi4J library which is a wrapper for the WiringPi C library.It works ...
Luca's user avatar
  • 131
0 votes
1 answer
459 views

Issues with Shift Registers and 8-Channel Relay on the Pi

Ok, been puzzled about this problem I have. So I've hooked up my 8-channel relay on the shift register (SN74HC595N) and I'm trying to simulate a simple on-off sequence for testing (using pi4j). So ...
Rafael Ibasco's user avatar
1 vote
0 answers
327 views

Increase Performance of 4x4 LED Matrix (Multiplexing with pi4j)

I have coded a Display-Class to drive a X by Y LED-Multiplexing-Matrix with pi4j. However, I when driving a 4-by-4-Matrix I cannot get the framerate beyond roughly 30 fps, which still produces a ...
Christian's user avatar
  • 111
0 votes
1 answer
435 views

Gpio state can't be changed when connected to a DC motor or led

I am using the pi4j library to control the gpios on the raspberry pi B, but I ran in the following problem: when I start a pi4j example like ControlGpioExample.java then the led(with resistor 220 ohm) ...
Mike Budimon's user avatar