Phil Wainwright Posted January 16, 2014 Share Posted January 16, 2014 Hi there all, I have a problem (Yes, I know, people have been saying it for years ) I am trying to wrap my head around programming a Raspberry Pi. The end task is simple, I have a Pi and a Piface digital. They are connected and I have control through the piface emulator. What I am trying to find is a bit of help with creating a very short programme. I have looked everywhere and posted on the Pi forum, but that post is now waiting to be moderated. I am wondering if anyone here could help me? what I want to do is:- (written in pidgeon basic) 10 Monitor input 1. 20 If input 1 is enabled, then I want to enable relay 1 30 Monitor input 2 40 If input 2 is enabled, then I want to wait (x) seconds and then disable relay 1 and enable relay 2 for seconds 50 Then disable relay 2 and enable relay 1 60 Monitor input 3 70 If input 3 is enabled, then end 80 Goto 20 Any one feel able to offer some help? Please Thank you Link to comment Share on other sites More sharing options...
GLaDOS Posted January 16, 2014 Share Posted January 16, 2014 I do not know, but is it really made from raspberries? Link to comment Share on other sites More sharing options...
Phil Wainwright Posted January 16, 2014 Author Share Posted January 16, 2014 No, not Raspberries...... It is made of chips But to be honest, even soaking it in vinegar, still a bit too crunchy for my liking Link to comment Share on other sites More sharing options...
GLaDOS Posted January 17, 2014 Share Posted January 17, 2014 Does it at least taste like raspberries? Link to comment Share on other sites More sharing options...
Phil Wainwright Posted January 17, 2014 Author Share Posted January 17, 2014 Ah, it does not taste of raspberries...... I have just realised that my comment about chips and vinegar probably will not make sense as you guys call them fries.... But the problem is not so much with the raspberries, but more with...... The Python Link to comment Share on other sites More sharing options...
vodkafan Posted January 17, 2014 Share Posted January 17, 2014 Phil what are inputs 1,2 and 3? Are they some sort of proximity sensors or something that is going to happen in a sequence? Question- do you expect input 1 and 2 to be on together? input 1 AND NOT input 2 AND NOT input 3= relay 1 input 1 AND input 2 AND NOT input 3 = start timer x (on relay 1) input 2 AND NOT input 1 AND NOT input 3 AND NOT timer x= relay 2 input 2 AND relay 2 AND NOT input 1 AND NOT input 3 = start timer y I think I am going wrong here....should be some OR in there. I take it relay 1 and 2 can never be allowed to be on at the same time even if inputs 1 and 2 are both made? I will think about it some more I am at work now.. Link to comment Share on other sites More sharing options...
Phil Wainwright Posted January 20, 2014 Author Share Posted January 20, 2014 Relay 1 and 2 cannot be on at the same time.... Relay 1 controls a motor, Relay 2 controls a brake for the motor..... The inputs are from switches for 1 and 3... input 2 is a relay controlled by an infra-red break-beam. So the routine is that the time values are entered in mS Press switch 1 and the motor runs. When the break beam is triggered, it then waits (x) milliseconds then the motor stops and the brake is enabled for milliseconds..... Then relay 2 is de-energised and relay 1 is re-energised. this cycle continues until switch 3 is pressed, then it returns to standby..... Hope this helps.... Thank you for your help. Link to comment Share on other sites More sharing options...
Recommended Posts