Hey guys, I’m having some trouble getting limit switches working in our robot. We are using 3 Limit Switches for different positions on the Lazy Susan. We have planned out the code in notepad as follows,
//ls1 = limit switch 1
//ls2 = limit switch 2
//ls3 = limit switch 3
// 1= go left
//-1 = go right
boolean left = 0
boolean top = 0
boolean right = 0
if (ls1 = 1) then
left = 1
end if
if (ls2 = 1) then
top = 1
end if
if (ls3 = 1) then
right = 1
end if
//button 4
if (left = 1 && top = 1 && right = 0) then
speed = 1
if(left = T) then
top = 0;
speed = 1until ls1 = 1
end if
if (left = 1 && top = 0 && right = 0) then
speed = 1
speed = 1 until ls1 = 1
end if
if (left = 1 && top = 1 && right = 1) then
speed = 1 until ls1 = 1
end if
if (ls1 = 1 and left = 1) then
speed = 0
end if
/button 5
if (left = 1 && top = 0 && right = 0) then
speed = - 1 until ls3 = 1
end if
if (left = 1 && top = 1 && right = 0) then
speed = - 1 until ls3 = 1
end if
if (left = 1 && top = 1 && right = 1 && ls3 = 1) then
speed = 0
end if
/button 3
if (left = 1 && top = 0 && right = 0) then
speed = 1 until ls2 = 1
end if
if (left = 1 && top = 1 && right = 0) then
speed = -1 until ls3 = 1
end if
if (left = 1 && top = 1 && right = 1) then
speed = - 1 until ls3 = 1
end if
if(ls2 = 1) then
speed = 0
end if
We need help initiating a boolean variable(or array), but we cant find it in LabView. help us pl0x.