I'm currently experimenting in using PD to control what appears on an LCD screen, but have had no luck so far! The LCD is connected to an Arduino UNO, and works using the preset Arduino sketches, however I am not sure how to use PD to control what is being displayed. I have experimented using Serial however have had no luck (I am also using serial to read analog inputs from the arduino (switches, buttons and potentiometers) which works well in my PD patch). Hope you can help.
-
Writing to LCD using PD and Arduino
-
Thanks for replying, I'll do my best to make the issue clearer. As far as the PD patch goes, I'm using the 'arduino' object to access 5 of the analog inputs (pretty much copied from the 'arduino-help.pd' file). The Arduino sketch pretty much just sets up the Firmata, but I have attached it.
The issue is that I don't know how to get Pure Data to talk to the Arduino to tell it what to display on the LCD screen.
-
Well, I'm not very familiar with Firmata. Can you send the preset Arduino sketches? I think I'll understand those better. Then I can probably help you with your issue.
-
@alexandros Attached are the preset Arduino sketches for Firmata - my sketch is made using the one named 'SimpleAnalogFirmata'. Thanks Firmata.zip
-
Sorry, I don't have an Arduino, but on another arm-based microcomputer I used i2c protocol to do that. There are objects to handle i2c in pd : https://github.com/zevv/pd-i2c, even if you'd have to compile them before use. I made similar externals also, but nothing proves mine are better than those (I'm not a coder). Or maybe in pd-l2ork?
It's also easy (and rewarding) to write things to the LCD from command line, and once you master it you can use the [shell] object to do it from whithin pd.
Sorry if I'm off topic...
Nau
-
@nau Thanks! I'll definitely consider these ideas.
-
@JamesHamilton when you say it "works using the preset Arduino sketches", what do you mean? It works with the Firmata examples provided with the Arduino IDE? Or are there some other sketches that don't use Firmata and work?
-
@alexandros The LCD screen definitely works and is connected properly, as it works with the LiquidCrystal sketches, for example the 'Hello World' one
-
So what you're trying to do is combine the LiquidCrystal examples with those from the Firmata library? Why not use the LiquidCrystal examples and just send data from Pd to the Arduino using [comport]'s "print" message?
What do you want Pd to control exactly? -
@alexandros The Pd patch is being controlled by buttons and switches connected to the analog inputs on the Arduino. The buttons and switch interactions are sent to pure data using the Firmata. I want these interactions to also change what is displayed on the LCD, and for the displayed information to be controlled in pure data. Does this make things a bit clearer?
The project all in all is going to be an audio effects unit. Pure data has a selection of audio processing patches which are controlled by the switches, buttons and a potentiometer. I'd like the LCD to display the audio effect which is selected, as well as the varying effect level (which is controlled by the potentiometer. I already have the pd patch working without the LCD, so I'm just trying to get that bit working.
Thanks
-
@alexandros The print message does work thanks, it works with the previous pd & arduino setup too, just included the LiquidCrystal library etc in the older arduino patch.
Could you suggest how to print to the second row on the arduino? Thanks a lot for your help
-
To be honest, I think the LCD stuff should be controlled from the Arduino and not Pd. Why have Pd interfere when the Arduino is actually getting all the data needed?
You can use an array of String objects and call them with the buttons you press. Can you send a Fritzing image of your circuit and the data you'd like to print according to button presses and all? I could probably write some Arduino code that does what you want.