piface digital 2

Does anybody have some samples (code) to control an piface digital 2 with xojo ?

piFace in Xojo using gpio and shall

App -> Event Handlers -> Run:

dim s As new Shell
While True
// Turn the LED on
s.Execute(“gpio -p write 200 1”)
// Turn the LED off
s.Execute(“gpio -p write 200 0”)

He already got it working using WiringPi …:wink:

Did he use the GPIO module for XOJO?

Yes, with a little declare added.

Read Here.

These methods are in the library but not in the GPIO module, you can declare the functions/subroutines as described there.

Try this:

link text

Thanks Petr but we already have it working.

@Petr Pelikan can you give a code snippet on controlling the relays on the board? Thanks!

@Petr Pelikan I’m using a pi face 2 connected to a pi 2 via gpio connection. How do you control the relays?

Thanks for the project file @Petr Pelikan I think I get it now, the relays are attached to the first two outputs.

Hi Ryan. Good you found the project file. I have a lot of work now, but if I find a free minute I will put a final version of this project on my web and send a link here.

@Petr Pelikan Please post the final project when you can it would help me a lot. Thanks!

Hi Ryan. You will find the final project here: http://www.pelico.cz/pages/raspberry.html


We used the MCP32… code using a declare the reference is in the website of WiringPi.

WiringPi MCP23008
Here you find what you need, i don’t have the code at hand but it’s made from there.

We searched trough all the documentation online in github of WiringPi, there we found the required parts.
You might find your answer above, perhaps i could find the code somewhere and post it online later.

Hi Ryan. I’m not sure if there was indeed the last version, so I put it there now: http://www.pelico.cz/pages/raspberry.html

@Petr Pelikan Thanks again!