Hi everyone. I have this assignment I have to do using RIMS and I need help coming up with an algorithm. The assignment is this:
An automatic door at a store has a sensor in front (A0) and behind (A1). The
door opens (B0=1) when a person approaches from the front, and stays open as
long as a person is detected in front or behind. If the door is closed and a person
approaches from the behind, the door does not open. If the door is closed and a
person approaches from the front but a person is also detected behind, the door
does not open, to prevent hitting the person that is behind.
Specifically the first one.
When A0 = 1 then B0=1 and stays 1 as long as A0 or A1 are 1, but the next part says if A1=1 then B0=0. Here is my code so far
Code:
Code:
void main()
{
while (1) {
if(!A0 && !A1)
{
!B0;
}
if(A0 && !A1)
{
B0 = 1;
}
if (A1)
{
B0 = 0;
}
/*if (A1 && A0)
{
!B0;
}*/
}
}
the current outcome. Right now when I flip A0, B0 lights up but when I flip A0 back and flip A1, B0 shuts off. Then when I set both A0 and A1 to 1, B0 starts flashing.
Thank you in advanced. Also if anyone knows how to use the RIBS software or knows a good tutorial may you please share. Thanks!