Replies: 6 comments 2 replies
-
As you are asking, I do not see initializing pi4j prior to the new LedStrip(pi4j, pixels1, 0.5) Context pi4j = Pi4J.newAutoContext(); |
Beta Was this translation helpful? Give feedback.
-
Just some debug info to check to make sure the GPIO pins are working:
My code now looks like this:
And when I run the Jar I get this:
|
Beta Was this translation helpful? Give feedback.
-
import com.pi4j.plugin.mock.provider.spi.MockSpi; |
Beta Was this translation helpful? Give feedback.
-
With the mock provider removed does it compile ? Was looking in your zip file. I would also expect the spi builder code to include .provider("pigpio-spi") Didn't see, or missed, what type of Pi you are using and haven't read the chip datasheet, so I have no suggestions on the mode or channel (chipSelect) or speed |
Beta Was this translation helpful? Give feedback.
-
https://forums.raspberrypi.com/viewtopic.php?t=260037 |
Beta Was this translation helpful? Give feedback.
-
I went back to this conversation and looked at making SPI work correctly based on details I gleaned from the WEB, I pushed a java device that controls an 8 LED neopixel strip. https://github.com/Pi4J/pi4j-example-devices/blob/master/src/main/java/com/pi4j/devices/neopixel94v/README.md The readme provides a terse explanation of the code AND the fact you must modify the /boot/config.txt adding in these two lines core_freq=250 core_freq_min=250. (pertains to Pi4 ) With this change the above mentioned java code can control the neopixel. R G and B are the true colors, yellow and orange are not correct but I have not figured out the correct 3 bytes for those. Setting the core freq does effect the system performance. My Pi 4 is 8 GB running pi-os64. To run a simple performance test I used mvn clean install -Pnative to build all the Pi4j code. Without the /boot/config.txt change a build consumed about 5 minutes. With the config.txt change the build required 30 seconds additional time. So for this one example the config.txt change was a 10 percent slowdown. Of course different loads may/will have different results but I wanted to see that the change did not cripple the Pi. @StealthRT @FDelporte |
Beta Was this translation helpful? Give feedback.
-
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 to my java swing application.
The code I am using:
But when I run it I get this error:
I have referenced:
pi4j-plugin-mock-2.1.1.jar
pi4j-core-2.1.1.jar
and my classes are:
LedStrip.java
ledStripTest.java
My eclipse swing project:
WSLedTest.zip
What do I need to set the pi4j in order for this to work?
Beta Was this translation helpful? Give feedback.
All reactions