Shop OBEX P1 Docs P2 Docs Learn Events
Problems with the ThreeServoPositions.bs2 and the ServoControlWithDebug.bs2 — Parallax Forums

Problems with the ThreeServoPositions.bs2 and the ServoControlWithDebug.bs2

robofan301robofan301 Posts: 4
edited 2013-04-01 17:31 in BASIC Stamp
I have been working through the "What is a Microcontroller?" tutorial and everything was going great until I got to the Servo motors.

The ThreeServoPositions.bs program has the servo hold three different positions for 3 seconds. However, instead of doing that, It runs the 45o position 3 times, then quickly does 90o and jumps back to the 45o. This goes on indefinitely until I cut power from the servo to Vdd. Once I do that it executes the remainder of the program. It seems to be getting feedback from the Servo that is making it start over, before it is finished the loops. Today I tried to run the program that has the user type in the Pulsout data and rotate it to different positions. However, as soon as I hit 1 digit, it automatically jumps through the remainder of the program. Meanwhile the servo remains locked in 1 position, until I cut power to it.
Has this happened to anyone else, working through the tutorials? Could it be a bad servo?
I am using the Parallax servo that came with the Basic Stamp HomeWork Board Kit.
Thanks

Comments

  • PropNut1960PropNut1960 Posts: 23
    edited 2013-04-01 13:43
    How are you powering the servo? It sounds like you might have the servo power (red) connected directly to the Stamp. If this is the case, that's the problem, the Stamp cannot directly supply the amount of current needed to run the servo and it keeps going into a Brown Out condition which resets the program.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-04-01 13:43
    It sounds like your battery may be low. When this happens the servo can draw more current than the batteries can provide causing the voltage to sag and the BASIC Stamp Module to brownout. This causes the code to restart. You can verify this by putting a DEBUG statement at the beginning of your code that prints, "PROGRAM STARTED" or something similar. If you see the message more than once your BASIC Stamp Module is browning out and you need to replace your battery.
  • robofan301robofan301 Posts: 4
    edited 2013-04-01 17:31
    Ok you were correct about the battery. I put in a new battery and The ThreeServoPositions program now runs the way that it is supposed to.

    Also, the ServoControlWithDebug still was not working correctly, so I went back and checked the code.

    It turns out that I forgot to put the formatter "DEC" in front of the variable "duration", so it must have been reading it as a bit.

    Thanks for all of the help and the rapid response.
Sign In or Register to comment.