ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to write a program to control a robot arm (a Lynxmotion 5, specifically) using the serial port. Now, I've often been told that serial port programming is a lot easier using Java (with the javax.comm package) as opposed to using C.
I was wondering if you guys had any suggestions or experience to share. Another thing to keep in mind is whether the java code will later be able to be used as part of a device driver which I may write for the same robotic arm.
If you are planning on writing a device driver for Linux then it must be written in C.
However... if the robot speaks RS-232 then I don't see a good reason for writing a driver in the first place. All you really need is a user space program that users the serial driver already in the kernel. In this case it comes down to a matter of personal preference, as it is quite easy to write to the serial port driver in both C and Java.
Hmm. The driver can provide some additional functionality I think. For example, I can have control timing in kernel space so that I can have 2 servos moving but appearing to move together (I guess like multi-processing). Of course, a side reason is that it'll give me an excuse to write a driver and thus understand the kernel better
It's not that nice to program in kernel space. And the only reason to do that is... to modify or improve the kernel. Now I understand that you want to learn, but wouldn't be nicer if you would do 2 separate things ? Something more meaningfull for kernel space, and a user space program that control the robotic arm.
In any case good luck with your robotic arm! I've done something vaguely similar on serial port, and it's really nice when something it's moving controlled by the computer.
All you really need is a user space program that users the serial driver already in the kernel.
The driver is serial_core.c right? I don't understand anything in it. I could try reading the source code of a serial driver already in the kernel, but looking at their sizes I doubt if I'll get anywhere anytime soon. Since I'm working for on a college project the main aim is to get the robot moving, to be honest I don't care for perfection (deadlocks, race conditions and the likes :/)
So, do you guys have any suggestions on how to go about it, would you recommend Java for my purpose then? Or perhaps some source code or documentations that would help me?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.