Page 1 of 2

Coordinate output via USB

PostPosted: Mon Apr 22, 2019 4:33 pm
by CADdy
Hi all,

is there a way to output the current X, Y, Z values via a USB interface? It should be the field numbers 226-228 (XposDRO, YposDRO and ZposDRO) found in UCCNC MACROS - 1-2105.pdf ? Is there anything to read about how to tackle such a project?

Background: I want to display the coordinates via the USB interface on a LC-display in a pendant.

Sincerely
Peter

Re: Coordinate output via USB

PostPosted: Mon Apr 22, 2019 5:54 pm
by dezsoe
Hi Peter,

To output the coords is simple if you have the protocol to the display. It can be done in a macroloop or a plugin, depending on your USB device.

Re: Coordinate output via USB

PostPosted: Mon Apr 22, 2019 9:10 pm
by CADdy
Hi dezsoe,

my idea would be to send the coordinates via USB interface to an Arduino Leonardo, which then displays the values on a 20 x 4 LCD. Could something like this be realized?

Sincerely
Peter

Re: Coordinate output via USB

PostPosted: Mon Apr 22, 2019 9:43 pm
by dezsoe
Hi Peter,

Yes. My problem was that USB is a hardware protocol, but as you wrote the Arduino, now it means a virtual serial port. That works fine. How do you want to get the coordinates in the Arduino? I mean, one string with all the three coords or any coded format? Do you have the Arduino side ready or you'll make it later?

Re: Coordinate output via USB

PostPosted: Tue Apr 23, 2019 10:38 am
by CADdy
Hi dezsoe,

the Arduino side isn't finished yet. I wanted to clarify first whether my project is realizable. Since the Leonardo has the possibility to simulate keyboard keys, I would like to add a few keys to the pendant, which e.g. set the mode of the handwheel, or switch the spindle on and off, etc..

I know that there are ready-made pendants that have all this already integrated. But I want to do it myself, just because it's fun. If it works, I would publish all the information here. However, I would be happy if I could get support for the implementation in UCCNC.

Sincerely
Peter

Re: Coordinate output via USB

PostPosted: Tue Apr 23, 2019 4:43 pm
by dezsoe
Hi Peter,

I'm afraid that the keyboard emulator uses HID standard. Then it emulates a keyboard and you cannot send out info. (Or maybe you can, but then you have to modify the library and write your own HID data sender.) I think it's much easier to have a normal serial communication between the Arduino and UCCNC. Then you have the key to anything. You can send commands to UCCNC from the Arduino and your macroloop or plugin can call buttons or do anything and also UCCNC can also send any data to the Arduino.

Re: Coordinate output via USB

PostPosted: Tue Apr 23, 2019 5:30 pm
by CADdy
Hi dezsoe,

yes, the library emulates a normal HID keyboard. Of course you're right, I haven't thought about that yet. There is your suggestion to work on a serial communication the better way.

But I don't know how to program macroloops or plugins for UCCNC. A little help would be necessary. The Arduino part would be the smaller problem. If I understand that correctly, it should be possible with almost every Arduino. HID would only be a hindrance.

Greetings
Peter

Re: Coordinate output via USB

PostPosted: Tue Apr 23, 2019 6:54 pm
by ger21
You'll need to learn C# or VB.NET, as that's what the macros are written in.
The basics are not that hard to learn. What you want is a bit more difficult for a beginner.

Or you'll need someone to write them for you.

Re: Coordinate output via USB

PostPosted: Wed Apr 24, 2019 7:04 am
by CADdy
Hi Gerry,

the basics of C# and VB.NET are not the problem. More is needed. In order to develop a useful and working macro, the possibilities and functions that UCCNC provides must also be known. I know that it is not trivial to implement something like this. To start with, I just wanted to send the coordinates to the pendant and a few functions to UCCNC. Learning by doing...

I'm reading the UCCNC MACROS - 1-2105.pdf - manual right now. Is that ok? Do I find in it what I need? Can I ask if there are any problems and hope that someone will help me?

Greetings
Peter

Re: Coordinate output via USB

PostPosted: Wed Apr 24, 2019 7:29 am
by dezsoe
Hi Peter,

I attach a small macro which handles my serial LCD. You can find ideas to start with, but it uses my own LCD protocol, so you have to modify it. However, you can see a basic communication. It is a macroloop, not a standalone macro.