Pwmpal?

MatthewMatthew Posts: 200
edited 2005-01-05 - 03:19:51 in General Discussion
Will the PWMPAL allow me to tell my microcontroller:

X=distance measured by ultrasonic sensor (takes approximately 0.1 seconds for sensor to detect change)

If X=18 through 22, do nothing

If X>22, then turn servo clockwise until X<22

If X<18, then turn servo counterclockwise until X>18


I would have the microcontroller take information from the ultrasonic sensor between the 20ms pause for the servo, but the sensor takes readings every 100ms. With the 'until' statement, I'm kind of having the microcontroller perform a multitask by keeping track of the distance and controller the servo. Will the PWMPAL allow me to do this?

Thanks.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-05 - 01:44:20
    You can use the PWMPAL to manage your servo (without any burden on the BASIC Stamp), but I'm not sure how you want to apply it with your sonar sensors. The PWMPAL has the ability to count pulses, but you would have to reset a counter, wait some period, then grab the pulse count. What this means is that your sonar sensor would have to start some pulse stream when it sends a pulse, then stop it when the echo is detected. If you're just looking to measure a pulse, PULSIN will do it for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • MatthewMatthew Posts: 200
    edited 2005-01-05 - 03:19:51
    Okay thanks Jon. I'll look more into it and form a better question.
Sign In or Register to comment.