2 Replies Latest reply on Sep 20, 2020 9:36 AM by hiteccol80

    PiFace Digital 2 and reaction timer

    robster

      Help!

       

      I'm a complete noob, although do have a bit of a background in programming.

       

      I have a Pi B+ and a PiFaceDigital 2 - all working fine etc..

       

      I want to create a programe that does the following:

       

      1)     Wait for an input on one of the inputs (a push switch or similar - there will be four connected)

      2)     When a push switch is activiate, tell me which push switch has been activated, and the time elapsed since starting the programme. I also want to activate one of the relays at this stage

       

      I can control the outputs in code, but am struggling with the interpupts to listen to the push switches. Also, not sure on the timing element - I guess I need to run a timer of some sort, and the interupt will stop the timer.

       

      As I'm a noob, I could do with seeing some examples of code - I'm quick to learn, and can adapt stuff, but I'm really struggling with the interupts element of the PiFaceDigital board.

       

      Any ideas? Help very much appreciated.

       

      Thanks!

        • Re: PiFace Digital 2 and reaction timer
          robster

          OK - I did this - but I have some problems with the PiFaceDigital not initialising - as it's seperate, I'll start a new question...

            • Re: PiFace Digital 2 and reaction timer
              hiteccol80

              Hi I read your question with great interest as I want to do something very similar with the same set up as you have.  Could you let me have your script please.

               

              My requirement is as follows but I am sure I could use your script.

               

              Help!

               

              I'm a complete noob at Python, although do have a background in computer hardware and electronics.

               

              I have a Pi B+ and a PiFace Digital 2 - all working fine and I can control each of the outputs from the emulator and the command line in code using one of the examples provided etc.

               

              I want to create a programe that does the following:

               

              1)     Wait for an input on one of the inputs (a push switch or similar - there will be four connected)

              2)     When a push switch is activiated, commence a sequence of turning each output on for 3 seconds then off before moving on to the next output for three seconds untill each output has been sequentually activated for three seconds then stop.

               

              I can control the outputs from the emulator and in code from the command line, but am struggling with the above sequence.

               

              As I'm a complete programming noob, I could do with seeing some examples of code - I'm quick to learn, and can adapt stuff, but I'm really struggling with putting this sequence together for the PiFace Digital board.

               

              Any ideas? Help very much appreciated.

               

              Thanks!

              Colin.