Comments (17)
Hi, I am going to look at it. Currently you have a problem because current implementation read one byte at the time. I'll change it back to read as many as you asked and try to deal with the problems I originally had with it (and reverted back to reading them one by one).
from pi4j-v1.
Thank you ;-)
from pi4j-v1.
Code is now in git. Go and give it a try. Now I know that at least one of following two is wrong:
a) one cannot read bytes successively, reliably from C file handle of i2c device
b) one cannot read bytes successively, reliably from WiiMotionPlus
I really hope it is the second one and that WiiMotionPlus is the one that dictates sending i2c address (in ioctl) followed with device address followed with reading of one byte each time... Or there's something else I've missed. I'll try to investigate it. In the mean time - please let me know if now you can get two bytes at the time from the MCP9808.
from pi4j-v1.
I will this evening, let you know the results asap.
from pi4j-v1.
Hi Ouwekaas, Any results? Thanks, Robert
from pi4j-v1.
Hi,
Sorry for the late response. I have been ill, felt a sleep behind the
steering Wheel and suffered from a car exident. I was hoping going futher
experiment comming week. I just arrived home this weekend.
Kind regards Michel
On Dec 8, 2012 7:06 PM, "Robert Savage" [email protected] wrote:
Hi Ouwekaas, Any results? Thanks, Robert
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-11161517.
from pi4j-v1.
I tried je 0.0.4 version, but run into an Exception unfortunately... the old code 0.0.3 version works without the second byte.
i@raspberrypi ~ $ sudo java -jar pi4jtest.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.pi4j.io.i2c.impl.I2CBusImpl.(I2CBusImpl.java:94)
at com.pi4j.io.i2c.impl.I2CBusImpl.getBus(I2CBusImpl.java:70)
at com.pi4j.io.i2c.I2CFactory.getInstance(I2CFactory.java:53)
at nl.pikkasoft.tempsensor.test.TestSensor.main(TestSensor.java:14)
Caused by: java.lang.NullPointerException
at com.pi4j.util.NativeLibraryLoader.load(NativeLibraryLoader.java:225)
at com.pi4j.jni.I2C.(I2C.java:55)
... 4 more
Just discovered I do not know how to handje git sources.. please could you build for me a 0.0.4 jar file? In the mean time I gonna learn myself how to handje git sources.... :(
from pi4j-v1.
I'll have a quick look at it later today, but I am sure it is a problem in a build.
I am just curious - how did you get pi4j library: did you build it yourself from the source, refer to it in your maven project or just used jar file directly? (hm - last two should do the same thing)
from pi4j-v1.
I tried to use te library because I couldn't find the 0.0.4 jar file.
from pi4j-v1.
What does that mean?
How did you organise your project - is it a maven build or you just use IDE like Eclipse or Idea?
BTW jar file should be in: https://oss.sonatype.org/content/repositories/snapshots/com/pi4j/pi4j-core/0.0.4-SNAPSHOT/ - take the latest from there.
from pi4j-v1.
I didn't know or didn't looked good enought. I happy to get the new Jar file.
The result is, this is working! Thank you ! ;-)
from pi4j-v1.
pi@raspberrypi ~ $ sudo java -jar pi4jtest.jar
Dec 11, 2012 1:09:40 PM com.pi4j.util.NativeLibraryLoader load
INFO: Library [pi4j] loaded successfully using embedded resource file: [jar:file:/home/pi/pi4jtest.jar!/lib/soft-float/libpi4j.so]
Amount of byte read : 2
Data : -64 hex 0xc0
Data : -27 hex 0xe5
pi@raspberrypi ~ $ sudo i2cget -y 1 0x18 0x05 w
0xe5c0
from pi4j-v1.
Cool! I am glad it worked out.
But, if you want - I can give you a hand setting up your project in such way you never get to this point again. That is why I asked you how do you develop it/build it.
One (not so bad way) is to set up a maven project, describe dependency to pi4j-core in it and let it do the rest. All you need to do in that case is to increment version of pi4j-core jar to match the latest and let maven do the rest for you. It works quite well with Eclipse and with IntelliJ Idea.
it is quick and I don't mind making an example for you and attach it here if you want and explain how to keep it in sync with your IDE...
from pi4j-v1.
Hello Natdan,
My apologies for my mistakes. I just being a Java programmer for 2 year on my company, besides of 14 year Senior Cisco IP Telephony job ;-) And I have to figure it out all on my self.
I use Eclipse Java EE IDE on Mac OSX
Juno SR1, build id 20121004-1855
I never used GITHUB or similar. I understand I should focus on Maven instead of Git. An example project would be much appreciated.
Thanking you in advance.
Kind regards Michel.
from pi4j-v1.
No apologies and I am not sure you made any mistakes. This is only like raising it to the next level! :)
Anyway here's short idea - get maven - download it and 'install' it. By install you can just download .zip or tar.gz and unpack it to some directory. Set MAVEN_HOME env variable to point to dir you unpacked maven and add MAVEN_HOME/bin to your PATH env variable. If you have problems with it - let me know (along which OS you are using).
Start with having following directory structure:
your-project-name/
src/
src/main/
src/main/java/
src/main/resources/
src/test/
src/test/java/
src/test/resources/
Create pom.xml file in your project dir with, for instance, following content:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pi4jprojects</groupId>
<artifactId>pi4jtest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pi4jtest</name>
<dependencies>
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-core</artifactId>
<version>0.0.4-SNAPSHOT</version>
</dependency>
</ddependencies>
</project>
(I think this is enough for minimal project)
And then from your project dir you can type:
mvn clean install
to build the project. Or alternatively - to make Eclipse project so you can import it in Eclipse as existing project:
mvn eclipse:clean eclipse:eclipse
Don't forget to type above line each time you change pom.xml
from pi4j-v1.
Thanks, I gonna try this very soon ;-)
from pi4j-v1.
Check it again - I had to play with editing to get pom.xml come out properly! O: )
Now I just need to find a way to pass you a .tgz file of existing project of mine...
from pi4j-v1.
Related Issues (20)
- Where is the PCA9685 code? HOT 3
- Published artifacts have class file version incompatible with JDK 8
- Parity bit is not sent with 1.4 on serial0 rpi4 HOT 1
- Computer Module 4 IO board Pinout issue
- PCA9685 servo question: setAlwaysOff sometimes makes the servo jump to zero position HOT 3
- Could be posible to manage Baud of 5800 on Serial0
- NoClassDefFoundError com/pi4j/io/gpio/gpiofactory HOT 5
- Not able to use spi in emteria.os
- Serial Port won't open HOT 5
- Can I use this library for other boards? HOT 2
- dependency on javax.xml.bind makes it impossible to jlink on JDK 11 HOT 3
- Question - change pinMode of GpioPinDigitalMultipurpose HOT 1
- [Question] serial control signals physical pins HOT 2
- J8 pin Different HOT 1
- PCIe x1 connector HOT 3
- Sorry, not something I can answer as the Pi4J project doesn't provide PCIE access.
- Serial buffer waits 100ms before letting me "read()" the bytes
- problem with openhab on pi4: not handling mcp23017 HOT 1
- vcgencmd is in /usr/bin on some systems - can you check this if /opt/vc.... isn't there
- Cannot run program "/opt/vc/bin/vcgencmd"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pi4j-v1.