goochii
11-19-2011, 05:34 PM
okay, so this is my first time on this website and i struggled to find anything that answered my problem. Sorry if this is the wrong topic area, but it seemed to fit.
To start off with some background, my classmate and i are doing a miniproject so to speak in our allied tech engineering class. We had never, ever even used any programming code before and kind of threw ourselves into unknown waters with this project. The goal was that this project can be set up in a hallway and detect people that walk by. When the people are detected, a motor spins a transmission, raising a head on a rod. That head would then look around the hallway then return to the resting position.
All the coding has been done in BASIC Stamp 2.5 and a Board of Education Microcontroller.
So far in programming we have successfully coded the raising, holding and dropping of this rod and head. However, what we cant do is that when the rod is holding in the upright position, a second motor will run and spin the head. unfortunately, the code is on a school computer and we cannot access it, but the code is some what simple.
it is something like:
IF IN0 = 1 THEN
duration = duration - 100
ENDIF
we have this setup for all possible combinations that require action from sensors. however, when the rod goes up to a holding state, we can get the motor to spin the head, just not evenly. What kind of code should we be writing in the subsystem for it to run evenly in both directions(forward and reverse)? or even better, how can we say something like, turn 85 degrees, turn 170 degrees reverse, turn 170 degrees forward, turn 85 degrees reverse, return to main program?
Any help is appreciated. i understand the post is long and can seem confusing so just ask for clarification where needed! thanks!
To start off with some background, my classmate and i are doing a miniproject so to speak in our allied tech engineering class. We had never, ever even used any programming code before and kind of threw ourselves into unknown waters with this project. The goal was that this project can be set up in a hallway and detect people that walk by. When the people are detected, a motor spins a transmission, raising a head on a rod. That head would then look around the hallway then return to the resting position.
All the coding has been done in BASIC Stamp 2.5 and a Board of Education Microcontroller.
So far in programming we have successfully coded the raising, holding and dropping of this rod and head. However, what we cant do is that when the rod is holding in the upright position, a second motor will run and spin the head. unfortunately, the code is on a school computer and we cannot access it, but the code is some what simple.
it is something like:
IF IN0 = 1 THEN
duration = duration - 100
ENDIF
we have this setup for all possible combinations that require action from sensors. however, when the rod goes up to a holding state, we can get the motor to spin the head, just not evenly. What kind of code should we be writing in the subsystem for it to run evenly in both directions(forward and reverse)? or even better, how can we say something like, turn 85 degrees, turn 170 degrees reverse, turn 170 degrees forward, turn 85 degrees reverse, return to main program?
Any help is appreciated. i understand the post is long and can seem confusing so just ask for clarification where needed! thanks!