HOW TO: Virtual Cockpit / Device Link

Problems with your PC? Is your game screwed? Need advice? Let us know in here, we may be able to help.

Moderators: Board of Directors, Command

User avatar
Donkey
Pilot Officer
Pilot Officer
Adjutant
Staff
Posts: 2829
Joined: Thu Jul 03, 2014 9:21 am
Location: Luxembourg

Re: HOW TO: Virtual Cockpit / Device Link

Post by Donkey » Mon Aug 31, 2015 9:27 pm

Give me a shout if you need any help.
Image

Miki
Posts: 1600
Joined: Sat Apr 06, 2013 11:21 am
Location: France

Re: HOW TO: Virtual Cockpit / Device Link

Post by Miki » Mon Aug 31, 2015 9:50 pm

My main question is : is there a way to send directly numbers via serial port ?

I think I have to convert them before the serial, from the C#, then after the serial in my Arduino...

I'm trying to make a "simple" thing : have a red LED when gear up, a green one when down.

I'm able to read the gear position via DL and export the value (set to short) to the console.
On the other hand, I can't figure how to have a simple 1 or 0 to be read by my Arduino Uno... I mean like a real 0 or 1.

I think I need to convert the gear value (short) to somethning else but what ? Byte ?
Image

User avatar
Donkey
Pilot Officer
Pilot Officer
Adjutant
Staff
Posts: 2829
Joined: Thu Jul 03, 2014 9:21 am
Location: Luxembourg

Re: HOW TO: Virtual Cockpit / Device Link

Post by Donkey » Mon Aug 31, 2015 9:59 pm

I don't have an arduino so can't check, but a quick Google reveals: http://arduino.stackexchange.com/questi ... ule-serial.

The last answer suggests serial.parseInt(), the reference to which is here:

https://www.arduino.cc/en/Serial/ParseInt
Image

Miki
Posts: 1600
Joined: Sat Apr 06, 2013 11:21 am
Location: France

Re: HOW TO: Virtual Cockpit / Device Link

Post by Miki » Tue Sep 01, 2015 9:49 am

Thank you Donkey, I'll try that.
Image

Miki
Posts: 1600
Joined: Sat Apr 06, 2013 11:21 am
Location: France

Re: HOW TO: Virtual Cockpit / Device Link

Post by Miki » Tue Sep 01, 2015 9:55 pm

That is working ! :)

At least I've got a green light when my gear is down.

With C#, I convert Double to String,

With Arduino, I use serial.parseInt() (thanks Donkey), then convert to Int and compare result to a condition.

This is not an easy task, but I'm learning !
Image

User avatar
Donkey
Pilot Officer
Pilot Officer
Adjutant
Staff
Posts: 2829
Joined: Thu Jul 03, 2014 9:21 am
Location: Luxembourg

Re: HOW TO: Virtual Cockpit / Device Link

Post by Donkey » Tue Sep 01, 2015 9:56 pm

Fantastic news Miki, superb stuff!
Image

Miki
Posts: 1600
Joined: Sat Apr 06, 2013 11:21 am
Location: France

Re: HOW TO: Virtual Cockpit / Device Link

Post by Miki » Wed Sep 02, 2015 8:19 pm

Ok, let's go for a video.

First of all : it's WiP and I have a lot of things to do to get this gear indicator working well.
=> for example, the red LED is blinking, and it is not good. I have to fix that.
Devicelink seems to be a little more faster sending data, than in game, but I can add a short delay, etc etc.

Anyway, I think the principle is here.

I start with gear retracted, then put it down.

Image

User avatar
Donkey
Pilot Officer
Pilot Officer
Adjutant
Staff
Posts: 2829
Joined: Thu Jul 03, 2014 9:21 am
Location: Luxembourg

Re: HOW TO: Virtual Cockpit / Device Link

Post by Donkey » Wed Sep 02, 2015 8:50 pm

This is great stuff Miki. I may have to buy myself an arduino... ;)
Image

User avatar
Dickie
Group Captain
Group Captain
ACG Board
contributor
Posts: 13855
Joined: Sat Jul 14, 2012 12:15 pm
Location: Gloucestershire, England
Contact:

Re: HOW TO: Virtual Cockpit / Device Link

Post by Dickie » Thu Sep 03, 2015 1:34 pm

Miki, if you are willing, it would be great to release your program to the wider community with instructions. We can put it for download somewhere in ACG anyway.

Great work!
~S~

Miki
Posts: 1600
Joined: Sat Apr 06, 2013 11:21 am
Location: France

Re: HOW TO: Virtual Cockpit / Device Link

Post by Miki » Thu Sep 03, 2015 6:29 pm

For sure I'll do.

But I still have changes to make. As soon as I am happy with the result, I'll post.
Image

Post Reply