Proceeding for Arduino code integration in an already established application.

Hello,

I'm new on this forum and also on the Arduino platform, having just tried a few examples and applications tinkering with it.

My final objective is to use it to control things over Ethernet Shield using some relays, but I have some conceptual doubts regarding how should I go about doing that, so I would be very thankful if someone helped me on this matter.

As I understand it, I must develop on Arduino IDE to ensure maximum compatibility with any given Arduino hardware (in this case, it's a Xboard Relay made by DFRobot, based on Leonardo. It has two Relays and the Ethernet Shield). The problem here would be that I can't use my default IDE, C++ Builder XE from Embarcadero, because it supposedly does not make vital special pre-processing, which Arduino IDE obviously does. On C++ Builder XE, I already have a very large application, to which I want to integrate some (brief) code to communicate and send/receive instructions/answers to/from the board.

Then, which of the following is the correct conceptual proceeding?

  1. I must develop this code on Arduino IDE, then implement it as a .DLL
  2. Develop it directly on C++ Builder XE using the Arduino libraries. If this were the case, which one should I use? I have tried this method previously with Arduino.h and Ethernet.h, but it didn't really work, so I'm thinking maybe I did something wrong.
  3. Develop on C++ Builder XE with Indy sockets. For example, ensuring its compatibility with Ethernet Shield (am I even correct in supposing that?). I have also tried this method, but didn't work either.

In the end, I'm really confused as to which is the more conceptually/theoretically correct to do what I need, and also for future endeavors.

Finally, it should be noted that I develop my code and programs in a MacBook Pro, with a VMWare Virtual Machine, on Windows 2008 Server R2.

Thanks in advance to anyone that can help.

The problem here would be that I can't use my default IDE, C++ Builder XE from Embarcadero, because it supposedly does not make vital special pre-processing, which Arduino IDE obviously does.

No. The problem is that C++ Builder XE does not invoke the correct compiler, to generate object file for the Arduino.

  1. I must develop this code on Arduino IDE, then implement it as a .DLL

No. The Arduino hasn't a clue what to do with a DLL. You do need to develop the sketch using the IDE, though.

  1. Develop it directly on C++ Builder XE using the Arduino libraries

Won't do any good. The compiler is not going to produce Arduino-compatible object files.

  1. Develop on C++ Builder XE with Indy sockets. For example, ensuring its compatibility with Ethernet Shield (am I even correct in supposing that?). I have also tried this method, but didn't work either.

Color me surprised.

Thanks for the fast reply. I am still confused, though.

In regards to point #3, what is it that surprises you? That it doesn't work?

This much is clear: the software that goes inside my board must be developed in the Arduino IDE. This much I get. The question, then, is how do I get my other application (developed in C++ Builder XE) to communicate and/or control the board? There must surely be a way.

Thanks in advance.

I write tons of code for Arduino and hardly ever touch the Arduino IDE. There's no reason why you must use it. What you MUST do is use the correct compiler and tool chain. The easiest place to get them is from the IDE, but that doesn't mean you have to use the IDE. I do nearly all of my Arduino work from Eclipse.

The question, then, is how do I get my other application (developed in C++ Builder XE) to communicate and/or control the board? There must surely be a way.

Use a common communication interface and protocol between the hardware.

The business of communicating with a working Arduino from a program running on a PC is completely separate from the business of creating the Arduino program.

If an Arduino can communicate using an Ethernet shield it will have no means of telling what is at the other end of the Ethernet cable (or WiFi link, or whatever). It is only necessary for the Arduino to use the same comms protocol that the the other program uses.

That means you can develop the Arduino program using the Arduino IDE (or any other way you like) and develop the other program using whatever tools are most suitable for it. I use Geany for editing my code and use the Arduino IDE to compile and upload it.

...R

Ok, I understood how to continue. Thanks to all.

Best regards,
Patricio