WOW, This is a Noob Question...but
gr8_big_geek
Posts: 34
Alright All,
I've been working on this far too long I think. I've finished writing my own voice recognition program and that part is working great. I'm just now pulling out my old Parallax bread board and microcontroller so I can automate things in my lab. So here comes the "noob" moment. I'm doing a simple light on/off and I'm messing around with this servo and for the life of me I cannot remember how I solved this back in the day.
<enough of the back story; down to the problem />
Okay, the program goes like so:
{$STAMP BS2}
counter VAR word
FOR counter = 1 TO 150
PULSOUT 10, 1200
PAUSE 20
NEXT
Now that's fine because it flips the light to the correct position on the dimmer but when the program is done...lights out! The darn thing returns to the starting position (which is off). ARRG! How can I get the servo to flip to a position and just stay there until I run another command through the microcontroller?
I know I solved this issue like 3 years ago when I was playing with these before but I cannot find the old HDD that had all of those old programs on there.
Any and/or all help would be great.
Thanks in advance all!
your random Geek~
I've been working on this far too long I think. I've finished writing my own voice recognition program and that part is working great. I'm just now pulling out my old Parallax bread board and microcontroller so I can automate things in my lab. So here comes the "noob" moment. I'm doing a simple light on/off and I'm messing around with this servo and for the life of me I cannot remember how I solved this back in the day.
<enough of the back story; down to the problem />
Okay, the program goes like so:
{$STAMP BS2}
counter VAR word
FOR counter = 1 TO 150
PULSOUT 10, 1200
PAUSE 20
NEXT
Now that's fine because it flips the light to the correct position on the dimmer but when the program is done...lights out! The darn thing returns to the starting position (which is off). ARRG! How can I get the servo to flip to a position and just stay there until I run another command through the microcontroller?
I know I solved this issue like 3 years ago when I was playing with these before but I cannot find the old HDD that had all of those old programs on there.
Any and/or all help would be great.
Thanks in advance all!
your random Geek~
Comments
What's the pulse width for a starting position? What's the pulse width for an ending position? Each FOR / NEXT loop (like what you've got) essentially commands the servo to move to some position for the amount of time consumed by the PAUSE x # FOR loops.
The light is tied into a voice recognition program so when I speak, "lights at 50 percent" the lights will adjust to 50%. The servo is tied into my voice rec. program; so really all I need the servo to do is just hold right there and not move indefinitely.
PULSOUT 10, 1200 = lights at 100%
PULSOUT 10, 250 = lights at 0%
When I speak for the lights to be at any % between 100 and 0 I have a different .bs2 script which runs through my voice rec. program. I simply need the servo to hold where I need it. I'm thinking of a DO...LOOP but I cannot remember the syntax.
I'm reading through a bunch of Parallax PDF's now trying to remember how to get the servo to hold. I know you have to send pulses to it every so many ms' but I cannot remember how to set up that loop.
'
So you're saying running that code makes the servo move to the switch's on position, and then back? Check you batteries or something. That code moves the servo by adding 1 to your initial 1200 per for loop. That's pushing it past the servos limit as mentioned earlier but shouldn't cause it to reverse direction unless you have some other problem going on there.
' {$PBASIC 2.5} 'thank you for this also Jon!
counter VAR word
DO
FOR counter = 1 TO 200
PULSOUT 10, 1159
PAUSE 20
NEXT
LOOP
Got it! Sheesh, too much coffee and not enough sleep. It's working fine now. I speak the command and the lights go to the level I need for as long as I need them.
Thank you everyone for being there! Sometimes, you just need to type it out and then read back through what the heck you are thinking!
*mad scientist laugh* MUAHAHAHHAAHHAHA
Now my office is almost completely automated!!!! YAY, I'm almost an official Geek!
The Basic Stamp is just to control the little servos and switches that will turn things on and off based on the voice commands of the user. I'm working to expand the way in which the program takes in the information also. I figured by using the accelerometer in an android device I could have the program recognize where in the dwelling you are (based on quadrants. eg: quadrant 1-A is the master bathroom, etc). Then the voice rec. program would turn the devices relevant to your location on.
It's been a lot of fun I think!
Thanks again for all of your help!
Here is another voice that would love to get a look see at your command interpreter.
I have Microsoft Studio and can load C#. The real world interfaces do not do much with out control input and vice versa.
Regards,
SM
Here is an interesting article on it, http://www.devx.com/dotnet/Article/30866/1954 and it uses Basic Stamp and has the code to boot!