Shop OBEX P1 Docs P2 Docs Learn Events
can BS2e control 3 devices and 2 sensors at the same time? — Parallax Forums

can BS2e control 3 devices and 2 sensors at the same time?

guy20sanjoseguy20sanjose Posts: 13
edited 2011-09-22 10:33 in BASIC Stamp
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

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2011-09-22 10:26
    You will need to create a single program to manage everything, but the BS2e can handle multiple program slots and so depending on your needs you could spread things out. More than likely in your case there will be a single program that checks the sensors and then makes adjustments to the stepper motor and pumps as necessary.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-22 10:33
    It all depends ...

    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.

    attachment.php?attachmentid=78421&d=1297987572
Sign In or Register to comment.