Shop OBEX P1 Docs P2 Docs Learn Events
this is driving me nuts! — Parallax Forums

this is driving me nuts!

prestonpreston Posts: 3
edited 2004-08-19 04:14 in BASIC Stamp
·· I'm currently on chapter 5 in "what's an Micro Controller?".· I understand the content of the chapter and have finished all the projects besides project one at the end of the chapter.· I have milled over this the past days and need some input how to resolve this problem.

· i have a rctime and potentiometer curcuit controlling a servo (works fine).· The problem i'm having is turning a pin high when the servo is turning counterclock wise and turning a different pin high when the servo is turning clockwise.·· I understand munipilating the I/O with comparision statements but when the duration moves up or down the scale (500 through 1000 or vise versa) is the part i'm fuzzy with.· I've tried to make a seperate variable that is equal to the variable in the rc-time statement and pausing (10ms)·this variable and comparing this with the one in the rc-time statement( if time > timex then).· This only hosed up the program.

· Please give some advise and hints on how to solve this project.

thanks in advance

Comments

  • frasencifrasenci Posts: 34
    edited 2004-08-19 04:14
    preston ,

    to PULSE the servo yo must use a variable ( lenght of the pulse ) , you got that of course.
    The servo will turn either way depending on the lenght of the pulse , to be exact the range is 1000 ms for full counterclock to 2000 ms for full clockwise. With 1500 ms it stays centered.

    So , all you have to do is to put an IF statement before you pulse the servo ,.. i.e. IF ( pulse lenght ) > 1500 THEN clock wise , ELSE counterclock . ( Pin this or Pin the other put high.)

    Watch out for the Stamps timing !! If you have a BS2 the pulse lenght in ms should be only half the value... (

    Hope this helps
Sign In or Register to comment.