bobsparkes wrote:I have three PiFaces connected to the RPi via the PiRack. Board 0 works perfectly, both with python3 and with "piface-emulator".
With python3, it isn't possible to address the other boards (and, yes, I have changed the Junction connections appropriately). When I do "p.digital_write(1,1,2)", the RPi says it can't understand what the third ("board number") digit is for. When I use the emulator, there is no option called "View" to allow me to change from one board to another. OK. I must therefore have the older software, so I do the update and upgrade commands and then try to install the latest piface and piface-emulator software, only to be told that I already have the newest software in both cases. I've tried a dozen times, with the same results every time. Even more disturbing is that my requests to cs.man.ac.uk don't produce any answers. Where can I get the help I need?
Hello - I have the same problem. I have 2 Piffaces connected to RPi via PiRack. I am trying to light up the LEDs on the two boards one after the other. Board 0 work fine but not the second. Actually the LEDs on both the Pifaces light up when j=0 and none when j=1 or 2 or 3.
Were you able to solve you problem of addressing multiple pifaces ?
I am using the following test C program :
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "pifacedigital.h"
int main( int argc, char *argv[] )
{
uint8_t j = 0; /**< piface location iterator */
uint8_t i = 0; /**< Loop iterator */
uint8_t inputs; /**< Input bits (pins 0-7) */
int hw_addr = 0; /**< PiFaceDigital hardware address */
for (j = 0; j < 4; j++) {
/**
* Open piface digital SPI connection(s)
*/
printf("Opening piface digital connection at location %d\n", j);
pifacedigital_open(j);
/**
* Read each input pin individually
* A return value of 0 is pressed.
*/
for (i = 0; i < 8; i++) {
const char *desc;
if (i <= 1) desc = "pin with attached relay";
else desc = "pin";
/* Turn output pin i high */
printf("Setting output %s %d HIGH\n", desc, (int)i);
pifacedigital_write_bit(1, i, xOUTPUT, j);
sleep(1);
/* Turn output pin i low */
printf("Setting output %s %d LOW\n", desc, (int)i);
pifacedigital_write_bit(0, i, xOUTPUT, j);
sleep(1);
}
/**
* Close the connection to the PiFace Digital
*/
pifacedigital_close(j);
}
}