Xojo <---> Arduino ... pointers pls

  1. 3 weeks ago

    I am fairly new to Xojo but have done a lot of Arduino, BBB and RPi programming.

    I have a project where I'm working with OSX [Xojo IDE 2019r3.1] and want to do serial coms with an Arduino.

    The Arduino, as you must know, is hugely popular in terms of being an easy to program and inexpensive introduction to microcontrollers.
    As popular as the Arduino platform is [millions of users?] it absolutely boggles my mind Xojo doesn't have a nice little page entitled:

    "Simple Communications With Arduino Using Xojo".
    (1) Here's how you identify the port it's on.
    (2) Here's how you reliably send data back and forth to it [ .... key word "reliably"]

    [@Xojo IMHO uh .... boat seriously missed here .... and I have a feeling someone over there could prolly knock it out in a day]

    Unfortunately a Google search [Arduino + Xojo] turns up precious little.

    SO ... any links, advice, code examples, projects, etc. anyone could point me to, would be HUGELY appreciated.

    Thanks in advance! Cheers all,
    Ken

  2. Alex B

    Feb 5 Pre-Release Testers, Xojo Pro Vancouver - Canada
    Edited 3 weeks ago

    Coming from my marine electronics background, I have found the NMEA0183 protocol to be a bit old but reliable for simple point to point communication. Have a look at this serial transfer library: https://github.com/PowerBroker2/SerialTransfer You could modify part of this code to run on the Xojo side. Any sort of packet-based message transfer protocol with a CRC/Checksum to verify the integrity should work. If we knew more about what you were attempting to do we could help guide you to the best method.

    Other ways I have used in the past have been CANBus, RS485, and devices that support it, Ethernet/WIFI.

    Right now I am using a Raspberry PI with MCP2517FD (CANBus) to communicate to an ESP32 (Has built-in CAN controller) for a fuel monitoring system on a big fishing vessel.

  3. Mark C

    Feb 5 Pre-Release Testers, Xojo Pro Spain 03170

    Hi Ken,

    Serial ports, as you know, have been about decades before Arduino, there is nothing special in any way about Arduino serial ports (thankfully) so just look and search for 'serial' in the language reference and forum, there are masses of topics regarding serial communication, there is a great example in Xojo that demonstrates how to use the serial class in Xojo, it will give all the code and principle required to do what you expect.

    your (1) and (2) are covered completely in the examples, Arduino is, as you know, nothing special at all, its just another hobby platform like so many others, it uses serial communications and RS232/485, there is nothing specific needed to suggest an example needs to be 'Arduino' specific, its just serial comms.

    look in the examples folder of your Xojo installation for the serial port example and search the forum, which is really a most excellent source of serial class help, the forum will help you enormously with regard to serial communications, but serial comms has nothing specifically to do with Arduino so searching for that as a keyword or asking for Arduino help may likely have zero impact.

    Mark

  4. Jean-Yves P

    Feb 5 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 3 weeks ago

    I can add that it would be easier (and more reliable) to use some esp8266 ( or esp32) ans communicate with them using tcpsockets.
    it will be hell faster than serial, and easier to program. you have plenty of examples in the xojo example folder, for serial or tcpsockets. also explain here to us what you want to achieve and don't understand, we can surely help.

    edit: and if you search for "arduino" on this forum, you have plenty of posts to read.

  5. Robert W

    Feb 5 Western Canada
    Edited 3 weeks ago

    Xojo applications partner well with Arduino compatible hardware.

    In my opinion, the serial interface is good for debugging, but I'm not sure that I would want to use serial communications in the final implementation, unless there was no other choice.
    A couple of years ago, we had to upgrade the communications between a programmable logic controller (PLC) and a piece of telemetry equipment that had been communicating over serial ports. The PLC hardware had been modernized to eliminate serial communications as much as possible, replacing this with ethernet and wifi. I made a communications adapter using an ESP8266 wifi microcontroller (programmed using the Arduino IDE). The ESP8266 communicated with the legacy telemety device over the serial port, and then transmitted the received data to the PLC over wifi. During development, I used two different Xojo desktop applications: one to simulate the serial data source from the legacy telemetry device, and a second one to receive the re-transmitted wifi data and display it on the computer screen. This was much easier than having to use the actual hardware in the field, during testing. So, I have one Xojo application that can communicate over serial with an Arduino class device, and a second Xojo application that can communicate over wifi with an Arduino class device. The code for both Xojo applications is very simple. The wifi application is based on a Xojo example project in the Xojo examples folder "UDPExample.xojo_binary_project." The serial com code was based on example code in the language reference, but there are also some serial examples in the examples folder.

  6. Markus R

    Feb 5 Pre-Release Testers, Xojo Pro Europe / Germany / Lower Saxon...

    @Ken J Here's how you identify the port it's on.

    this example list devices
    SerialConnection.Device

    Here's how you reliably send data back and forth to it [ .... key word "reliably"]

    it need a checksum, others mentioned.

    i suggest to use TCP.

  7. last week

    Kato G

    Feb 16 Pre-Release Testers Europe (Norway)

    I use UDPsocket and JSON when communication with Arduino/esp32 found that to be the easy way.

or Sign Up to reply!