Jump to content

Raspberry Pi

Phil Wainwright

Recommended Posts

Hi there all,


I have a problem (Yes, I know, people have been saying it for years :D )


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 (y) 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 :D


Thank you



Link to comment
Share on other sites

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

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 (y) 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


  • Create New...