1

I have recently purchased a 'Piface Digital 2' and have been able to create programs to light up the built in LED'S with the built in buttons (as by watching the tutorials).

However now I have been trying to attach a external button via the terminals and what I want it to do is simply print 'hello world' in python 3 when the switch is pressed. Truthfully my problem is I cant find any tutorials on this matter and I am not sure what code is needed apart from;

import Pifacedigitalio as pfio
pfio.init()

I am confident my switch and circuit work as I have tested it in the emulator.

  • by external button I mean a button attached by two wires to the terminals

Any help would be appreciated.

If you need me to further explain anything ill be happy to

1 Answers1

0

I have worked out how to do this after a week of testing, I realised that to get a button press to be processed I have to connect it to the output terminals instead of the input terminals, and then I wrote a program in python to print 'hello world' I used pfio.digital.write(0,1)which turns terminal 0 on and pfio.digital.write(0, 0)to turn the terminal off. Once it is on the program became simple.