VB6 and Stamp
Archiver
Posts: 46,084
I've made a VB6 app that sends data to the serial port. I'm using a
joystick to create movement for the stamp. I need to send a couple
of different numbers to stamp at once: X-axis (x), Y-axis (y), and
throttle position (z). each one should have an integer range of -100
to 100.
So far I've been able to send X and Y but only as binary. Does
anyone have ideas?
Thanks,
Adam
joystick to create movement for the stamp. I need to send a couple
of different numbers to stamp at once: X-axis (x), Y-axis (y), and
throttle position (z). each one should have an integer range of -100
to 100.
So far I've been able to send X and Y but only as binary. Does
anyone have ideas?
Thanks,
Adam
Comments
write the numbers unless you use binary, or you can't read them? Or both?
Should be able to say something like:
MSCOMM1.OUTPUT=STR(x) & "," & STR(y) & chr(13)
Then on the Stamp side:
SERIN ...,[noparse][[/noparse]dec x,WAIT(","),dec y]
Off the top of my head that seems OK. Of course, binary is more efficient
but could get out of sync. Might put a sync character in front of the packet
too and another WAIT so you would be sure to sync on partial packets:
MSCOMM1.OUTPUT="@" & STR(x) & "," & STR(y) & chr(13)
SERIN ...,[noparse][[/noparse]WAIT("@"),dec x,WAIT(","),dec y]
Hope that helps,
Al Williams
AWC
*NEW: The simplest math/analog coprocessor ever!
http://www.awce.com/pak12.htm
Original Message
From: sumguy16hem [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=4wx9QOEvg9FFTy82NXAhhLUoorVFJ43qyMDCNrIhAR29mNqs8Sro-3WzgU_oEg7_oyIqoxllQrBTWf5oqQ]a.przybilla@c...[/url
Sent: Sunday, March 21, 2004 5:26 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] VB6 and Stamp
I've made a VB6 app that sends data to the serial port. I'm using a
joystick to create movement for the stamp. I need to send a couple
of different numbers to stamp at once: X-axis (x), Y-axis (y), and
throttle position (z). each one should have an integer range of -100
to 100.
So far I've been able to send X and Y but only as binary. Does
anyone have ideas?
Thanks,
Adam
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Yahoo! Groups Links
old' response, but thanks for the help anyways. I've managed to control
a servo through VB using a joystick, but I'm getting greedy and now I
would like to control two.
I'm sending two separate integers in VB with MScomm32. They are sent
every 1 millisecond using a timer. Here are my settings for MScomm32:
9600,n,8,1
I have handshaking disabled.
In my Stamp code I have:
SERIN 16, $4054, [noparse][[/noparse]WAIT("@"),DEC intsteering, WAIT(","),DEC intthrottle]
In VB:
MSComm1.output = "@" & Str(intSteering) & "," & Str(intThrottle)
I know my VB code is good, but when I connect the stamp, the servo just
jerks back and forth.
Thanks for the help!
Adam
Original Message
From: Al Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=p4Eu_IK1CX6f11Ee1OXxMttpV1c_lIFjBWsMyMIp8Wka7XLvUfyZ7SRllL8CXoC5e6TLhZE6zxGSIdfjFg]alw@a...[/url
Sent: Sunday, March 21, 2004 5:07 PM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] VB6 and Stamp
Well, that would depend. Are you using MSCOMM32? Are you saying you
can't
write the numbers unless you use binary, or you can't read them? Or
both?
Should be able to say something like:
MSCOMM1.OUTPUT=STR(x) & "," & STR(y) & chr(13)
Then on the Stamp side:
SERIN ...,[noparse][[/noparse]dec x,WAIT(","),dec y]
Off the top of my head that seems OK. Of course, binary is more
efficient
but could get out of sync. Might put a sync character in front of the
packet
too and another WAIT so you would be sure to sync on partial packets:
MSCOMM1.OUTPUT="@" & STR(x) & "," & STR(y) & chr(13)
SERIN ...,[noparse][[/noparse]WAIT("@"),dec x,WAIT(","),dec y]
Hope that helps,
Al Williams
AWC
*NEW: The simplest math/analog coprocessor ever!
http://www.awce.com/pak12.htm