Pause button for Robot arm and or function for multiple switches each performin
Hi Guys
I am using this and it makes the arm stop where it is right now problem i had made it emergency stop but now whats about the pause so if i press another button it continues from there
i Var word
switch pin0
switch pin1
For i= 110 to 1100 step 1
If switch=0 then
Goto M1
Pulsout shoulder,i
pause 18
Next
M1:
Pulsout shoulder,i
pause 18
Goto M1
Now this what i am using for emergency stop but now i dont know how i can make it as a pause if i pressed the button again how i can continue again from where i was before this what i have to do
M1:
Pulsout shoulder,i
if switch1 = 0 then what stuck here
i am stuck how to continue from there where i was before.
Post Edited (Sandhuamarinder) : 4/12/2010 11:47:27 PM GMT
I am using this and it makes the arm stop where it is right now problem i had made it emergency stop but now whats about the pause so if i press another button it continues from there
i Var word
switch pin0
switch pin1
For i= 110 to 1100 step 1
If switch=0 then
Goto M1
Pulsout shoulder,i
pause 18
Next
M1:
Pulsout shoulder,i
pause 18
Goto M1
Now this what i am using for emergency stop but now i dont know how i can make it as a pause if i pressed the button again how i can continue again from where i was before this what i have to do
M1:
Pulsout shoulder,i
if switch1 = 0 then what stuck here
i am stuck how to continue from there where i was before.
Post Edited (Sandhuamarinder) : 4/12/2010 11:47:27 PM GMT
Comments
2) Did you read the message I wrote on 4/4 at 10:57? It will do something like what you want, not for when you press the button a 2nd time, but when you release it. It's pretty easy to modify what I wrote to make it work when you press the button a 2nd time.
I am too dumb does not get stuff easily.
And i dont know how to deleate the topic can some one tell me.
Like I said, you have to reread the message. If you don't understand what I wrote, try to come up with specific questions about the technique and the parts you do and don't understand.
Sir can you just give me a quick example bcoz i am already left with a less time now
And can some one tell me
How to use or statement
Like i wants to use. I wants eithier emergency button is pressed or pause button is pressed it should goto M2 do i have to use OR like that or i have to use / like this.
Some one plz tell me i am running out of time and still lot of work do.
For i= 110 to 1100 step 1
If switch = 0 OR switch1 = 0 Then
Goto M2
Endif
Pulsout shoulder,i
Pause 18
Next
2) In the message on 4/4, I suggested moving all of this testing for an emergency stop and the PULSOUT itself and the PAUSE with it all to a subroutine and calling that from the different loops in your program. This has two advantages over what you're currently doing. One, it saves program space. Two, it allows you to return from your emergency button testing loop so your program can continue (and the emergency button will cause a pause, not just a stop). If you just use the GOTO as you've shown in your most recent message, there's no way for the program to continue. You could do the following, but you'll quickly run out of program space as you duplicate this loop over and over again:
for i = 110 to 1100 step 1
do
if switch2 = 0 then goto m2
loop while switch1 = 0
pulsout shoulder,i
pause 18
next
i had not tried new codes yet bcoz i don't have robot arm with me right now.
Hope fully i will try it very soon and i will post the results.
Post Edited (Sandhuamarinder) : 4/12/2010 6:27:28 PM GMT
if switch = 0 then
Goto M2
Puslout shoulder,i
Pause 18
Next
M2:
Pulsout shoulder,i
if switch = 0 then
Return
Pause 18
Goto M2
Now i Got it what u are saying sir
I will try it tommorrow and i will post the results
Post Edited (Sandhuamarinder) : 4/14/2010 4:32:48 AM GMT
Please reread the 4/4/10 message in the other thread. This cross-thread referencing is one reason why it's bad to start a 2nd thread on a subject rather than continue the discussion in the same thread.
do
if switch2 = 0 then goto m2
loop while switch1 = 0
pulsout shoulder,i
pause 18
next
But sir if i am sitting in M2 which is like this
M2:
Pulsout shoulder,i
Pause 18
Goto M2
Sir i am just wondering it will return with that up statement if i am sitting in M2 Loop if i had pressed switch2 just wondering i had not tested the codes yet. And it will start from same place if i pressed switch1= 0
If you move the PULSOUT and PAUSE into the DO / LOOP, the program will pause when switch1 is pressed and will maintain the servo position. In other words:
for i = 110 to 1100 step 1
do
if switch2 = 0 then goto m2
pulsout shoulder,i
pause 18
loop while switch1 = 0
next
Sir i need ur brain. Can i borrow it for this project.
U are awesome.
Thanks alot sir
You have a brain, you just need to practice using it more. You may not like to read manuals, but that can be a good way to learn, particularly when they're as well written as Parallax's. Get used to trying things out, particularly in robotics and computer stuff. Sometimes things work differently than they seem like they'd work on paper or with a simulator. You learn a lot from that sort of thing.
But i dont know how to make that work and i dont even have to figure it out right now. I have at such a critical situation.
And sir one more problem. Like if i press the emergency button right it goes to m2 loop but i wants to pizeo electric speaker there to freqout siren so where should i put freqout in M2 loop. So that siren should also work and also one LED should blink and also my Alarm will work and arm should also stay at the same position.
For i =110 to 1100 step 1
if switch = 0 then
Goto M2
Puslout shoulder,i
Pause 18
Next
M2:
Pulsout shoulder,i
Pause 18
Goto M2
if i do like this i get trouble i think arm falls down i remember i did that before but not remember what happened but something was wrong in there. Last time when i did this
And i wants my RED LED to be blinking and by siren gets of and on. I can another subroutine in that for making siren and LED to make of and on but problem is my arm doesnt stay there. Sir i wants to solve this my self but problem is i am out of time now.
M2:
Pulsout shoulder,i
freqout 1, 2000
High LED
Pause 18
next
From your questions, it's clear that you don't really understand yet how to do some simple things in programming and, before you go on, you need to spend time learning the basics and working through a lot of the exercises in the introductory tutorials (like "What's a Microcontroller?" and "Robotics with the BoeBot"). If there's no time left to do this, then I'm sorry, but that's what you need to do.
Thanks for the help Sir.