C# and psc (parallax servo controll)
kybr
Posts: 3
Hi,
im trying to control my psc directly from my computer with c# and without any basic stamp or anything. im using the serialport class in .net 2.0 , but cant get it to work.
when i send the psc the !SCVER command it just echos it, and i cant get the version number right.
i can controll the servos with the psci program from parallax ofcourse, so my setup is right [noparse]:)[/noparse]
what i got so far is something like this:
void main blablablba
{
SerialPort sp = new SerialPort();
sp.setcomport = COMX
sp.Write("!SCVER\r");
Console.writeline(sp.readline());
}
and that only writes !SVCER\r to my console....
anyone have some example code on how to get the version number just to get me started?
all help appriciated [noparse]:)[/noparse]
-stian
im trying to control my psc directly from my computer with c# and without any basic stamp or anything. im using the serialport class in .net 2.0 , but cant get it to work.
when i send the psc the !SCVER command it just echos it, and i cant get the version number right.
i can controll the servos with the psci program from parallax ofcourse, so my setup is right [noparse]:)[/noparse]
what i got so far is something like this:
void main blablablba
{
SerialPort sp = new SerialPort();
sp.setcomport = COMX
sp.Write("!SCVER\r");
Console.writeline(sp.readline());
}
and that only writes !SVCER\r to my console....
anyone have some example code on how to get the version number just to get me started?
all help appriciated [noparse]:)[/noparse]
-stian
Comments
I know NOTHING about C# so these are just random suggestions. Should the following:
sp.setcomport = COMX
perhaps be pointing to the actual comm port - say COM1 ?
What about parity, what does it default to? Given a choice, NONE is best.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Perhaps this article will be helpful:
http://msdn.microsoft.com/msdnmag/issues/02/10/netserialcomm/
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
but i will try to set it just to be sure.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?
I've killed a fly with my bare mind.
http://msmvps.com/blogs/coad/archive/2005/03/23/39466.aspx
I have used the mentioned SerialPort class without any problems.
regards peter