Arduino limitations. Can this be done?

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Message
Author
alioth
Posts: 91
Joined: Tue Aug 16, 2016 9:03 pm

Arduino limitations. Can this be done?

#1 Post by alioth »

I have seen the arduino API, and while it is good (really good for standard builders... switches, buttons, leds, encoders...) is far from what arduino can do ( SPI and I2C support.. custom librarys... )

I am not asking to implement complex things in the air manager API.

But.. If you could add a way to use serial comunication... we could send data from the this main arduino to other/others. And use the others with the arduino standard api for complex systems.

I think it would convert Air Manager into the best cockpit builder environment (software and hardware) I can imagine.

Arturo.

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino limitations. Can this be done?

#2 Post by Corjan »

Hi,


You are right, we don't support stuff like SPI and i2C on the Arduino. The main reason is because we want the system to be simple as possible.
Adding stuff like SPI would make the instrument lua code more 'technical', something we always try to prevent.

It would be cool though to have more control over your Arduino. I am thinking of making an Air Manager library for Arduino. It should add a way to send 'generic' messages between the Arduino and Air Manager. That way you can create your own Arduino program and have full control on what it should do while having a communication path with Air Manager.

But, you are the first one to request something like this, so don't expect us to start working on this immediately. We are kinda packed the coming year :)


Corjan

alioth
Posts: 91
Joined: Tue Aug 16, 2016 9:03 pm

Re: Arduino limitations. Can this be done?

#3 Post by alioth »

Corjan wrote: Wed Dec 06, 2017 5:06 pm I am thinking of making an Air Manager library for Arduino. It should add a way to send 'generic' messages between the Arduino and Air Manager. That way you can create your own Arduino program and have full control on what it should do while having a communication path with Air Manager.
This sounds perfect to me.
So, I just have to persuade some thousands of people to ask for the same :mrgreen:

Thanks for the quick response.

Arturo.

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino limitations. Can this be done?

#4 Post by Corjan »

Haha, yes :) Let me know when you find them :)

Corjan

oldairmail
Posts: 32
Joined: Sun Feb 12, 2017 7:55 pm

Re: Arduino limitations. Can this be done?

#5 Post by oldairmail »

alioth wrote: Wed Dec 06, 2017 5:22 pm
This sounds perfect to me.
So, I just have to persuade some thousands of people to ask for the same :mrgreen:

Thanks for the quick response.

Arturo.
Good job, you've persuade me. :D

After New Years, I'll start getting back into AM3 & Arduinos.

What I want to do is fairly simple - Interface LEDs and servomotors with P3d V4.

Buttons, switches, and encoders are super simple though.


Thanks everybody for some great software.

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Arduino limitations. Can this be done?

#6 Post by Ralph »

LED's and servo's can easily be done with our API. Nothing special needed for that :)

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino limitations. Can this be done?

#7 Post by Corjan »

I went ahead and implemented it anyways :)

There will be a bidirectional way to communicate between the instrument and the Arduino.
Every message has it's own 16bit ID, and a variable payload of 0 - 8 bytes can be attached.


Arduino side:

Code: Select all

#include <si_message_port.h>

static void new_message_callback(uint16_t message_id, uint8_t* data, uint8_t len) {
	// We received a message from Air Manager or Air Player
	
	// data argument is only valid during the execution of this function
	// Clone the data if you wish to retain it.
	
	// Send a message back to Air Manager or Air Player
	uint8_t data[3] = { 0x00, 0x09, 0xAA };
	if (si_message_port_send(777, data, 3) == SI_MESSAGE_PORT_RESULT_OK) {
		// Message is on it's way!
	}
	else {
		// Something went wrong sending our message
	}
}

void setup() {
  // Initialize on channel A
  si_message_port_init(SI_MESSAGE_PORT_CHANNEL_A, new_message_callback);
}

void loop() {
  // Make sure this function is called regularly
  si_message_port_tick();
}
Instrument side:

Code: Select all

-- This function will be called when a message is received from the Arduino.
function new_message(id, payload)
  print("received new message with id " .. id)
end

id = hw_message_port_add("ARDUINO_MEGA2560_A", new_message)

-- You can also send messages to the Arduino
-- In this case a message with id 777 with 3 bytes (0x01, 0x02, 0x03)
hw_message_port_send(id, 777, [ 1, 2, 3 ])
This will be included in the next AM 3.1 BETA.

Corjan

alioth
Posts: 91
Joined: Tue Aug 16, 2016 9:03 pm

Re: Arduino limitations. Can this be done?

#8 Post by alioth »

Cool!
Thanks.

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino limitations. Can this be done?

#9 Post by Corjan »

Hi,

First release of the library is finished, more information here:
https://siminnovations.com/wiki/index.php?title=Arduino

The latest Air Manager BETA is compatible with this library:
https://siminnovations.com/wiki/index.p ... sktop_BETA


Corjan

Ncngrr
Posts: 38
Joined: Sun Oct 29, 2017 6:30 pm

Re: Arduino limitations. Can this be done?

#10 Post by Ncngrr »

So... please forgive the stupid question... I have zero experience with Arduino.

Is the idea to interface Arduino with Air Manager INSTEAD OF directly with P3Dv4? I use FSUIPC within P3Dv4. I believe FSUIPC supports the interface of additional hardware devices (including Arduino controlled devices) on my main P3Dv4 PC. Is the point here to add those additional devices to a networked PC and talking to P3Dv4 through Air Manager?

Thanks.

Scott

Post Reply