Shop OBEX P1 Docs P2 Docs Learn Events
New user. great site. Need help with the basic stamp!!! ugh — Parallax Forums

New user. great site. Need help with the basic stamp!!! ugh

flcrackerflcracker Posts: 5
edited 2009-10-06 01:46 in BASIC Stamp
Hi everyone

trying to help my daughter w her sci fair project.· i think· i am in over my head.· She want to open the blinds (rotate 90*) when the alrm goes off.· wants to get her sister out of bed quicker! (so she is not late for school).· so here i am.· we built the BS and hooked up the servo. wrote and ran the basic three turn program.· hmm. scratch, scratch...· so ive got to get the speaker hooked up to the i/o pin?· however that works.· and get it to start the servo to rotate 90*.· sounds so darn simple.· debug this and loop that.· i read the book (loosely). just a little hard to understand all this stuff.· very interesting, yet unfamiliar.·
So if someone thinks they can help·a father out... let me know.· i would be soo thankful.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-09-30 00:49
    Sure, show us what you have so far and we can flesh it out for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • flcrackerflcracker Posts: 5
    edited 2009-09-30 01:13
    Stephen
    Thanks so much. we have built the circuit for the servo on the stamp. the three turn program works as it should. i just need the servo to turn 90 degrees, so i need to augment the program to do this. the option to open and close (rotate 90 then back and loop) would be of interest also.

    So, thats about as far as we have gotton. The signal will come from the speaker current when the alarm goes off. so i need to get this current to the stamp. and have it run the servo. does this help?

    Below is the basic program from the book that we input...


    ' What's a Microcontroller - ServoTest.bs2
    ' Test the servo at three different position signals.

    ' {$STAMP BS2}
    ' {PBASIC 2.5}

    counter VAR Word


    DEBUG "Counterclockwise 10 o'clock" , CR

    FOR counter = 1 TO 150
    PULSOUT 14, 1000
    PAUSE 20
    NEXT

    DEBUG "Clockwise 2 o'clock", CR

    FOR counter = 1 TO 150
    PULSOUT 14, 500
    PAUSE 20
    NEXT

    DEBUG "Center 12 o'clock", CR

    FOR counter = 1 TO 150
    PULSOUT 14, 750
    PAUSE 20
    NEXT

    DEBUG "ALL DONE"

    END
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-30 03:53
    The position of a standard servo depends on the width of the control pulse. Normally this ranges from 1ms (1000us) to 2ms (2000us). With a BS2 Stamp, this translates to a PULSOUT value ranging from 500 to 1000. Many servos have a slightly wider range, but there's no standard. What you might do is to use a small program that lets you test your particular servo and determine the PULSOUT values for the positions that you want. Something like this:

    ' {$STAMP BS2}
    ' {PBASIC 2.5}

    pulse VAR Word
    counter VAR Byte

    start:
    DEBUG "Enter a value from 250 to 1250",CR
    DEBUGIN pulse
    FOR counter = 1 to 150
    PULSOUT 14,pulse
    PAUSE 20
    NEXT
    GOTO start
  • flcrackerflcracker Posts: 5
    edited 2009-10-06 01:46
    Hey thanks
    I got the coding done for the servo!!!! mission accomplished!! tested and works...
    I want to start the program with a pulse from the alarm clock speaker. here in lies my next problem. Need an if then code for the siganl.. i am totally in the dark.

    can someone shed some light please. i have this

    ' {$STAMP BS2}
    ' {PBASIC 2.5}

    ??? not sure what shohuld go here

    IF
    in1 = 1

    THEN
    Go sub "have blinds open"

    OPEN BLINDS

    END



    so basically i dont know.
    i appreciate this help. i need to have this written and working tonight!! wahooo

    thanks
    Stephen
Sign In or Register to comment.