Look at pictures of R/C servos if you haven't already. They have either a disc mounted on the shaft or a cross-like "4-horn" adapter, either shape with holes for piano wire which becomes the "push rod". As the servo shaft turns, the piano wire can push / pull the door so it opens and closes. The "What's a Microcontroller?" tutorial and the "Robotics with the BoeBot" tutorial discuss how servos work and gives lots of examples. Both are included in the help files when you install the Stamp Editor which includes the Parallax Basic compiler. You can also download the tutorials by going to Parallax's main webpage and clicking on the Downloads button. On the downloads page, these will be under "Educational Tutorials & Translations". You can also download the "Basic Stamp Syntax and Reference Manual" under "Stamp Documentation". To wait 24 hours, you'd do:To move the servo through somewhere from 90 to maybe 120 degrees you'd do:Code:hours var byte minutes var byte seconds var byte for hours = 1 to 24 for minutes = 1 to 60 for seconds = 1 to 60 pause 1000 next next nextSomewhere in your program's initialization, you'd need to make sure the door is closed. HaveCode:servo pin 1 ' or whatever I/O pin the servo is connected to count var byte for count = 1 to 50 ' allow 1 second for the servo to move to the open position pulsout servo, 500 ' this number could be as low as 250 depending on the servo pause 20 ' servos need about 20ms between pulses next for seconds = 1 to 15 ' whatever number of seconds the door should be opened pause 1000 next for count = 1 to 50 ' again, allow about 1 second for the servo to move to closed position pulseout servo, 1000 ' this number could be as high as 1250 depending on the servo pause 20 ' servos need a 20ms pause between successive pulses next
another copy of the last 4 lines above to do this.




Reply With Quote




Bookmarks