How do I make some musical notes, then enables the servo… and if I do not need music and can I do?
I also do not know how to tell it to move to one position, pause, then move to another position, than pause, then repeat, so I m afraid that you have to tell me every thing in detail and step by step.
I changed jumper back to VS back to the position as in my picture I sent you before. I pressed “program”, and the servo also moved once then stopped, about the same as the jumper at 5V.
Thank you very much and waiting for your further information.
When you click program, the program is on the basic atom, so you don’t need to click program any more. You only need to click program when you want to change it to do something different.
lets try this with separate power supplies for servo and logic.
Leave the wall pack connected to VS terminals.
Remove the jumper called VS=VL
Connect 9vdc battery clip to VL
Apply power to the board and see if the servo moves back and forth.
I could not tell from the last picture if the whole chip was fully plugged in and seated properly or not.
Also you might try changing to a different IO pin, example P4 and see if that changes anything. The program would have to change as well as to reflect which IO pin you are using. Maybe something like:
[code]
MYSERVO con P4
hsPosition var sword
Position1 con -14000 'about -90 degrees (adjust to desired angle)
Position2 con 14000 'about +90 degrees
Time1 con 2000 '2 second pause value (adjust)
Time2 con 4000 '4 second pause value
I changed the code slightly to allow you to easily change which IO pin to use for the servo. You just need to change the MYSERVO value. Also I dded some toggle commands in for IO pins 12-14. This should cause the LEDS on the BB2 to change state as the program runs. This gives us a good idea that it is running…
I did not do any thing with your code but copy and paste the all codes to the program page. Should I put some thing in your code to allow it work? If so, how? could you please give me a example? Thx.
Yongxin
I updated Jim’s code above to change the servo pin to pin 4. I added toggles of the three pins 12-14 of the BB2 that has LEDS on it, as to make sure the program was not getting hung. From the sounds of it, the program is running OK. Now assuming the Servo has been moved to P4, I am suspecting 1 of two things:
Servo is bad - As Jim suggested it would be good to try a different servo.
The digital servo does not like that large of a range. So try changing the the values of position1/2 from ±14000 to maybe ±7000 and see if that makes a difference.
Power to the servo. Do you have a volt meter? Could you measure the voltage going to ground to the power pins of the group you are using… Measure from a pin in the three pin groups that is closest to the outside of the board (-) to the center pins of the 3 pin groups (+)
I used an analog servo. I’ll bet you are right. The pulses are out of range! I will test / modify the program using a 5485 servo in the morning. Sorry!
[code]MYSERVO con P4
hsPosition var sword
Position1 con -7000 'about -45 degrees (adjust to desired angle)
Position2 con 7000 'about +45 degrees
Time1 con 2000 '2 second pause value (adjust)
Time2 con 4000 '4 second pause value
Thanks a lot.
I tested 7000± and it worked well but it traveled about 150 degrees rather than 180 degrees as I need. I wish I can try 9000± but the servo kept traveling when it connected the power. I am not sure I can reprogram my servo when it is running. If I cannot, could you please tell me how I can stop the servo when it connects the power.
The next question is the servo travels too fast (>60rpm), how can we adjust its speed, for example, make it to about 10 rpm, ?
Thank you again
Yongxin