Comments (13)
Sure, I'll look into it this weekend.
from diozero.
Just pushed an untested class to github, not updated any repository builds yet. Let me know how you get on with it - looking at the datasheet it was (unsurprisingly) very similar to the MCP23017. If it works I'll work on merging the 2 classes as they are so similar.
from diozero.
Cheerrs buddy. I'll try and import it sometime tomorrow. Thanks for the quick implementation!
from diozero.
Hey,
Completely forgot about this. I apologies. I was just wondering, Is it possible to use your library to write to a LCD over i2c with the MCP23008 chip?
Cheers
from diozero.
I've only tested LCDs fitted with a PCF8574T I2C backpack (see the second image here: http://www.raspberrypi-spy.co.uk/2015/05/using-an-i2c-enabled-lcd-screen-with-the-raspberry-pi/). The code probably won't currently work with the MCP23008 as it uses a slightly different I2C communication protocol. Should be fairly straightforward to refactor the code to work with different IO expanders if you fancy a challenge. I only have an MCP23017, I could try unsolder one of my LCDs and try but won't have time to do this until after Christmas.
from diozero.
I've just committed untested changes that may allow use of I2C LCD displays connected via an MCP23008. Use the I2CLcd(GpioExpander gpioExpander, int columns, int rows)
contructor, i.e. new I2CLcd(new MCP23008(), columns, rows);
, New 0.9-SNAPSHOT builds have been pushed to sonartype Maven snapshot repositories.
I need to regression test my I2CLcds to make sure I've not broken anything. It will take a bit of effort for me test with an MCP23008 not least because I only have an MCP23017 (but they are very similar). Let me know how you get on with it, fingers crossed.
from diozero.
Sweet, I'll give it a poke. Will the snapshot be on Nexus?
Edit: didnt click all versions - I see it now ;)
from diozero.
May be being stupid here, but getting this exception:
Exception in thread "main" java.lang.IllegalStateException: Error: no device provider factory service found, please configure META-INF/services/com.diozero.internal.spi.NativeDeviceFactoryInterface or set -Dcom.diozero.devicefactory at com.diozero.internal.DeviceFactoryHelper.init(DeviceFactoryHelper.java:80) at com.diozero.internal.DeviceFactoryHelper.getNativeDeviceFactory(DeviceFactoryHelper.java:88) at com.diozero.api.I2CDevice.<init>(I2CDevice.java:66) at com.diozero.MCP23008.<init>(MCP23008.java:130) at com.diozero.MCP23008.<init>(MCP23008.java:120) at com.alex.noble.i2c.MainTest.main(MainTest.java:16)
` public static void main(String[] args) throws Exception {
MCP23008 mcp = new MCP23008();
I2CLcd lcd = new I2CLcd(mcp, 16, 2);
lcd.addText("Testing");
}`
Apologies if its something painfully obvious, been programming all day! :)
from diozero.
Ok, I can confirm that the LCD code still works on my setup, command:
sudo java -cp tinylog-1.1.jar:diozero-core-0.9-SNAPSHOT.jar:diozero-provider-sysfs-0.9-SNAPSHOT.jar com.diozero.sampleapps.I2CLcdSampleApp16x2
Looks like you've not included a provider JAR file in your classpath. diozero is designed to work with different implementations, including Pi4j, WiringPi, pigpio plus some limited but pure Java ones that I've developed. I guess I should include my one within the main JAR file as a default to simplify the classpath. Just need to add SPI support and do further testing,
from diozero.
I'll re add Pi4J and let you know. Mistake on my behalf - totally didn't read the instructions properly :)
from diozero.
Good news is that I have a very old PiFace kicking around that I'd never used before. This has an LCD screen controlled by an MCP23S17. The bad news is that this is different to your configuration plus I don't have code for the SPI equivalent of the MCP23017. Job for another day... Good luck.
from diozero.
Did you get anywhere with this? I've just committed changes that should make this much easier. There is a new LcdConnection interface that gives you programmatic control over how you communicate with the LCD. I have tested this successfully with the MCP23S17 (SPI) included in the PiFace Control and Display board. Should be trivial to do this with an MCP23008 (I2C).
from diozero.
Marking this issue as closed; I have successfully tested LCDs connected via MCP23S17. I should now be trivial to connect via other means, including GPIO.
from diozero.
Related Issues (20)
- Refactor StepperMotors for broader usage HOT 2
- Probable bug in new StepperMotor setups HOT 3
- How to realize infrared reception HOT 1
- RockPi 4a. Problems with specific gpio pin HOT 1
- WS2811 Led doesn't work on Tinker board R2.0 HOT 1
- WS2811 in tinkerboard HOT 5
- SSDOled won't work for I2C channel HOT 5
- I2C devices are not thread-safe HOT 7
- Using pigpio without root HOT 1
- closing serial port causes close eventloop and shutdown HOT 1
- Enhancement request/offer: SN3218 HOT 1
- Enhancement Request: active braking for PwmMotor HOT 1
- PCA9685 has troubles with certain servo angles HOT 5
- BUG: Updates to board info causing errors/messages HOT 5
- SsdOled "display" methods are confusing
- Add board info support for Raspberry Pi 5 HOT 3
- MockFactory throws warning exceptions when run on non-supported systems (non-critical)
- Emhancement: Make I2C devices "shareable" HOT 1
- Can't close and re-open MFRC522 HOT 3
- Support IRQ triggering for more efficient MFRC22 tag reading HOT 1
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 diozero.