I was wondering if there is some way to control a servo's position with my computer.
for example when i click a button on my screen the servo goes to a defined position.
A circuit diagram or any code would be helpfull
Grab the ol' picaxe manual #2 and find these commands:
How do i get it to send a signal when i click something. Is there some software i need?
I can help you. I have done this exact thing many times and it is no big deal. However, I need to be sure we are on the same page so we can communicate better. Please tell me the page number (in the picaxe manual number 2) where you found the serrxd command. That's it. You give me the page number for the sertxd command and I can give you all the help you need.
I would look over the servo command and get that up and running by itself. Once you get that code written, adding the terminal control should be a piece of cake.
I found the serrxd on page 194 and the sertxd on page 197.
oh and ive got the servo up and running directly from the picaxe.
Cool, you have done some homework and are on the step you should be on --sorry about jumping throught the hoops.
The sertxd and serrxd commands use the picaxe terminal which will pop up with F8 after you have sync'ed your program in. The terminal allows you to send data to your picaxe. You can receive from the picaxe as well.
Your code will be something like:
select case b1
servo(pin_number,wherever you want it)
servo(pin_number,some other position)
Now, you really should use servo at the top and servopos after that and yadda yadda, but the above should work and will change positions when you hit a,b or c on the terminal then hit "send".
Give me a shout with any problems.
AWESOME!! it worked exactly how i wanted it to.
Thankyou so much :D
Oh, just one last question.
what is baud rate?
and what does changing the baud rate number do?
Baud rate is a measure of how fast digital communications happen, in this case between the PICAXE and the computer. The higher the baud, the more bits of information get sent every second.
If the baud rate doesn't match for both devices, the comms won't work. Increasing the baud rate on both devices allows for more data to be sent per second, or the same amount of data to be sent faster, but the signal is more likely to be affected by noise so you get more errors.
baud rate is how fast you are sending data back and forth. The picaxe chips are famously slow in this regard. I think the older ones top out at 4800 baud or 9600 if you double thier frequency. I would say, use 4800 or 9600 for everything unless otherwise stated somewhere (i.e. a LCD module or something). You should also know that picaxe uses an inverted signal. This will never be a problem with the picaxe terminal going to a picaxe chip but if you use another terminal program or a different sync cable, this may become an issue. When using the "regular" serial command, there is a "N" or "T" before the baud --N2400 or T2400. This is to tell the chip that you want iNverted signals or True signals.
What you just did with the terminal is also the same thing you would do to get 2 picaxes talking to eachother etc. Note: If you have a program in the chip that uses sertxd or serrxd, you will have to use the reset button the next time you want to sync a new program.
Add this to your program (Put it right after each servo command):
sertxd ("I just got your command, you sent ",b1)
sertxd(10,13) 'this is linefeed and carrage return (i.e. goto next line on the terminal)