Giter Site home page Giter Site logo

Trouble with I2C about pi4j-v2 HOT 11 CLOSED

pi4j avatar pi4j commented on June 21, 2024
Trouble with I2C

from pi4j-v2.

Comments (11)

rz259 avatar rz259 commented on June 21, 2024 1

Ok, the problem is resolved. I have downloaded the latest snapshot and now it works.

Thanks for your help,

Rudi

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

Hi, did you add the linuxfs-ic2 plugin:

<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-plugin-linuxfs</artifactId>
    <version>2.0-SNAPSHOT</version>
</dependency>

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

In my project i use the following dependencies:

<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-core</artifactId>
    <version>${pi4j.version}</version>
</dependency>
<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-plugin-raspberrypi</artifactId>
    <version>${pi4j.version}</version>
</dependency>
<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-plugin-pigpio</artifactId>
    <version>${pi4j.version}</version>
</dependency>
<dependency>
    <groupId>com.pi4j</groupId>
    <artifactId>pi4j-plugin-linuxfs</artifactId>
    <version>${pi4j.version}</version>
</dependency>

from pi4j-v2.

rz259 avatar rz259 commented on June 21, 2024

This are the dependencies I use:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- include Pi4J Core -->
        <dependency>
            <groupId>com.pi4j</groupId>
            <artifactId>pi4j-core</artifactId>
            <version>${pi4j.version}</version>
        </dependency>

        <!-- include Pi4J Plugins (Platforms and I/O Providers) -->
        <dependency>
            <groupId>com.pi4j</groupId>
            <artifactId>pi4j-plugin-raspberrypi</artifactId>
            <version>${pi4j.version}</version>
        </dependency>
        
        <!--  
        <dependency>
            <groupId>com.pi4j</groupId>
            <artifactId>pi4j-plugin-pigpio</artifactId>
            <version>${pi4j.version}</version>
        </dependency>
        -->
        
        <!-- include provider for linuxfs-i2c -->
		<dependency>
		    <groupId>com.pi4j</groupId>
		    <artifactId>pi4j-plugin-linuxfs</artifactId>
		    <version>${pi4j.version}</version>
		</dependency>        

As you can see, the plugin for pigpio is commented out and this way it works fine. When I remove the comments to include the pigpio-support, then I get the error message I described above

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package lib.armhf in both module com.pi4j.library.pigpio and module com.pi4j.library.linuxfs

To make the program work again, I have to do the following:

  • remove or comment out the dependency in the POM-file
  • remove the two jar files for the pigpio from the directory on my raspberry
  • remove the two jar files for the pigpio from the target/lib-directory on development machine

As I also need to access gpio-ports I am looking for a working solution. I don't understand why this is not working.
Do I use the wrong modules? Maybe there are newer modules available that circumvent or remedy the problem?

Thanks for all help,

Rudi

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

Hi, so you can use both pigpio and linuxfs plugins, but i think there is something wrong with the module configuration of the packages. Are you using modules? Do you need to use modules? I'll have to test this and find out what the problems with the modules is, but i'm not yet very versed in this affair...

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

Do you by any change have a larger stack trace?

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

@rz259 I've found a problem, where the native libraries are in the same directory in the jars for both plugins. I have now changed the directory for the linuxfs native libraries. Can you try again with the latest snapshot version?

from pi4j-v2.

rz259 avatar rz259 commented on June 21, 2024

Hello eitch,

unfortunately I do not have a larger stack trace.

How can I download the latest snapshot version? I deleted the files from the raspberry and from the local computer and thus maven downloaded the versions - but unfortunately I can't tell you if they are the newest snapshot.

At any case the files that got downloaded by Maven do not solve the problems, so it would be nice if you could give me a hint how to download the latest snapshot.

Kind regards,

Rudi

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

Hi Rudi. Can you check in your maven repository when

.m2/repository/com/pi4j/pi4j-library-linuxfs/2.0-SNAPSHOT/pi4j-library-linuxfs-2.0-SNAPSHOT.jar

was built?

Kind regards
Robert

from pi4j-v2.

rz259 avatar rz259 commented on June 21, 2024

Hi Robert,

the jar was built on 2021-07-29 18.35 h (European Summertime).

Thanks for your help,

Rudi

from pi4j-v2.

eitch avatar eitch commented on June 21, 2024

from pi4j-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.