Motion Control Telephone lift
in BASIC Stamp
I am new to programming. I need to move two panels in sequence. They will be driven by DC powered motors on rack gears. I have everything built and now need to move it.
Please view the attachment showing the workings and basic parts.
Any help would be much appreciated
The sequence of movements:
sequence:
1- Phone rings or up button pushed
2- upper cover panel slides to open position and stops (proximity sensor)
3- lower table moves to upper position and stops (Proximity sensor)
Panels will stay in thse positions unless option 4 is pushed. This will put the unit back in waiting for sequence 1.
4- optional: down button pushed
reversing sequence to down position
Please view the attachment showing the workings and basic parts.
Any help would be much appreciated
The sequence of movements:
sequence:
1- Phone rings or up button pushed
2- upper cover panel slides to open position and stops (proximity sensor)
3- lower table moves to upper position and stops (Proximity sensor)
Panels will stay in thse positions unless option 4 is pushed. This will put the unit back in waiting for sequence 1.
4- optional: down button pushed
reversing sequence to down position

Comments
You'll have to write to code for both.
We can help you with this if you show enough interest.
' telephonelift.bs2 ' {$STAMP BS2} ' Select BS2 as target module ' {$PBASIC 2.5} ' Select PBASIC 2.5 as language 'sequence: '1- phone rings or up button pushed '2- upper cover panel slides to open position and stops '3- lower table moves to upper position and stops ' Panels will stay in these positions unless option 4 is pushed. This will put the unit back in waiting for sequence 1. '4- optional: down button pushed ' reversing sequence to down position ' ======================= [variable declarations ] ================ true CON 1 ' boolean constants false CON 0 ' input pins with switches: coverisclosed PIN 0 coverisopen PIN 1 tableisup PIN 2 tableisdown PIN 3 movephoneup PIN 4 movephonedown PIN 5 phonerings PIN 6 'output pins motor control through L298H dual H-bridge enableA PIN 7 ' upper motor on/off dirA1 PIN 8 ' forward/reverse upper motor dirA2 PIN 9 enableB PIN 10 ' lower motor on/off dirB1 PIN 11 ' forward/reverse lower motor dirB2 PIN 12 ' ========================= [ main ] ======================== DIRS = %1111111110000000 ' set pins 0..6 input (0), 7..15 output (1) DO DO ' wait LOOP UNTIL (phonerings = true) OR (movephoneup = true) ' phone rings or up switch pressed GOSUB opencover GOSUB movetableup DO ' wait LOOP UNTIL (movephonedown = true) ' down switch pressed GOSUB closecover GOSUB movetabledown LOOP ' forever END ' ==========================[ end main ] ============== ' ------------------------ [subroutines ] ------------- opencover: ' opens the cover HIGH dirA1 ' set upper motor to turn one way LOW dirA2 HIGH enableA ' turn upper motor on DO ' run upper motor LOOP UNTIL (coverisopen = true) ' cover open switch is pressed LOW enableA ' stop upper motor RETURN ' --------------------------------------- closecover: ' closes the cover LOW dirA1 ' set upper motor to turn other way HIGH dirA2 HIGH enableA ' turn upper motor on DO ' run upper motor LOOP UNTIL (coverisclosed = true) ' cover closed switch is pressed LOW enableA ' stop upper motor RETURN ' --------------------------------------- movetableup: ' moves the telephone table up HIGH dirB1 ' set lower motor to turn one way LOW dirB2 HIGH enableB ' turn lower motor on DO ' run lower motor LOOP UNTIL (tableisup = true) ' table up switch is pressed LOW enableB ' stop lower motor RETURN ' --------------------------------------- movetabledown: ' moves the telephone table down LOW dirB1 ' set lower motor to turn other way HIGH dirB2 HIGH enableB ' turn lower motor on DO ' run lower motor LOOP UNTIL (tableisdown = true) ' table down switch is pressed LOW enableB ' stop lower motor RETURN ' ------------------------ [end subroutines ] ----------------- ' ========================== [end program ] ==========================but I do not know how to connect a switch (SW7 in the schematic) or another type of sensor to a telephone to check if it is ringing. Maybe somebody else has an idea...
Thanks a lot
David
David
In the earlier schematic I forgot the 220 ohm resistors on the IN ports of the BS