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
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
How do i get it to send a
How do i get it to send a signal when i click something. Is there some software i need?
You first…
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.
In the meantime
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.
Page numbers
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.
Correct answers!!
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:
main:
serrxd b1
select case b1
case "a"
servo(pin_number,wherever you want it)
case "b"
servo(pin_number,some other position)
case "c"
servo(pin_number,another position)
endselect
goto main
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
AWESOME!! it worked exactly how i wanted it to.
Thankyou so much
Oh, just one last
Oh, just one last question.
what is baud rate?
and what does changing the baud rate number do?
Baud rate is a measure of
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
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)
ok. thanks again
ok. thanks again
Is it possible to do
Is it possible to do something similar but the servo changes position when i press a button on my keyboard??
Is it possible to do
Is it possible to do something similar but the servo changes position when i press a button on my keyboard??
Yes but…
This is indeed possible but the picaxe terminal will not do it. Instead you would need to write a small piece of code for your computer to keep an eye on the keyboard, and when something is hit, send off a bit of data via your serial cable to the picaxe. This could be written in Processing, java, VB, python, pearl or whatever you would like.
Another option is to simply plug the keyboard into the picaxe. The picaxe supports PS2 keyboards --I think the command is keyin or kbin… something like that.
so what type of code do i
so what type of code do i write for vb??
could you give me a sample