can BS2e control 3 devices and 2 sensors at the same time?
guy20sanjose
Posts: 13
My project requires one stepper motor, two water pumps, one humidity sensor and one temperature sensor. There are three programs total. Can a basic stamp2e handle all these components? Do I need to combine all of them into one program?
Thanks
Thanks
Comments
The Stamps are single-threaded microcontrollers. They essentially do one thing at a time. Typically that's not an issue for reading sensors and turning things like pumps on and off because you don't need to read the humidity and temperature at precisely the same time. You read one sensor, then you read the other sensor, then you decide what you're going to do with the readings and turn something on or off. The complication is with the stepper motor and the question for you is whether the stepper motor has to move all the time. If so, you'll have to use a separate stepper motor controller like this one. If the stepper motor just moves and waits for the sensors to be read again and decisions to be made, you won't need the separate controller.
You will have to combine the various pieces of your project's programs and integrate them together. Often people make subroutines ... one reads the humidity ... one reads the temperature ... one moves a stepper motor to a new position ... you have an initialization section that sets up everything and you have a main section that calls the subroutines and does the decision making.
There's limited variable storage on all the Stamps, so you often have to share variables when combining several programs. Look at the description of aliases in the Stamp Manual.
If you need specific help, be sure to post your program or programs.