Elevator Controls
M. Wilson
Posts: 4
Hi everybody:
······ I am having problems putting together the servo controls and the push button controls. Separately they work fine.· However when I put them together the servo will not work.· I built the servo from figure 4-21, page 130 of the "What's a microcontroller?" book.· I think the out put from the push button controls, P-15 (pg. 1) must be linked to the servo input before the servo will take commands.· When P-15 (pg.1) goes high it should·cause the servo to rotate cw·180 degrees, pause seven seconds, then rotate 180 degrees.
I would appreciate any help you can give me.
M. Wilson
······ I am having problems putting together the servo controls and the push button controls. Separately they work fine.· However when I put them together the servo will not work.· I built the servo from figure 4-21, page 130 of the "What's a microcontroller?" book.· I think the out put from the push button controls, P-15 (pg. 1) must be linked to the servo input before the servo will take commands.· When P-15 (pg.1) goes high it should·cause the servo to rotate cw·180 degrees, pause seven seconds, then rotate 180 degrees.
I would appreciate any help you can give me.
M. Wilson
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Second: what exactly is your project?
I am working on model·Elevator controls
Here's a better attachment. The servo controls I used is located on page 130 of "What's a Microcontroller" Book
button PIN 15
LED PIN 16
'etc
Next up is lines 69 to 71 (the loop.) You have it set so that it loops 7 thousand times. Bad idea. You can just insert a PAUSE 7000 to make it idle for seven seconds. Same idea at 83 to 85.
Now that I've covered that, might I add that the code will *never* reach that section since it is preceeded by a DO-LOOP with no possibility of escape. Your best bet would be to place the servo stuff in a method, that you then call with GOSUB. You then call the method after testing for the button. You also don't need the LOW 14 at line 45 since that is your servo line. Final note: use comments! I have no idea what all that stuff in the DO-LOOP is supposed to do, and your code is no help. It looks like you test a bunch of things, but why? What are the preconditions and post condidtions? Comments are an essential part of all programming.