Questions tagged [pi4j]

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

Projects Homepage with tutorials and release notes.

Source on GitHub

60 questions
24
votes
1 answer

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
  • 479
  • 2
  • 4
  • 12
6
votes
2 answers

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 the display. However, when I run the program…
4
votes
1 answer

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 using both I2C buses, 0 and 1, in my application.…
MountainPi
  • 41
  • 1
  • 2
3
votes
2 answers

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 larger program and it is possible that it is created…
3
votes
0 answers

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 data connected to an RFID Tag ID into a…
3
votes
2 answers

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
  • 195
  • 2
  • 10
3
votes
1 answer

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 refresh on only a 5x10 led display. I am using the…
3
votes
2 answers

Native C access to wiringPi from PI4J

I appreciate the PI4J project and the access it provides to GPIO from Java (my language of choice) however, compared to C, Java is much slower. Normally this is not a problem but I was working with accessing the HC-SR04 ultrasonic TX/RX and I…
Kolban
  • 1,794
  • 2
  • 16
  • 28
3
votes
1 answer

pi4j provisionDigitalOutputPin without setting state low

How can I? I want to run a program every few minutes with cron. I read a file of times that I expect pins on or off and then check the state of each pin and set them accordingly. It works fine and leaves the pins in the last set state on program…
brian
  • 181
  • 6
2
votes
0 answers

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 = 14 LCD_PLATE_EN = 13 LCD_PLATE_D4 …
Alex
  • 71
  • 4
2
votes
1 answer

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, so I tried to start the motors like a servo. It…
cy8berpunk
  • 29
  • 7
2
votes
1 answer

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 Controller) requires a PWM signal of about 385Hz…
Peter Zhu
  • 278
  • 3
  • 12
2
votes
1 answer

Ultrasonic sensor get distance with java

I use this script http://devilqube.blogspot.nl/2013/02/using-ultrasonic-range-finder-with.html to get values from my ultrasonic sensor. When I run the code and print the distances it results in a lot zeros with sometimes 165.7 as value. Im sure the…
user15105
  • 21
  • 3
2
votes
1 answer

Using PI4J to toggle a led on a breadboard

Since yesterday I been trying to figure out how to turn on a led on and off, my problem is that Pi4J (from what I can see) only takes up to 20 GPIO inputs and my breadboard is set to 30 and from a to l, I even tried to use only to the 20th spot on…
Debels
  • 21
  • 3
2
votes
2 answers

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 Context context = Pi4J.newAutoContext(); final…
nexalbyte
  • 123
  • 4
1
2 3 4