FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Arduino Leonardo Requests DTR to be high · Issue #37 · SolidSoils/Arduino · GitHub

Repository navigation

Arduino Leonardo Requests DTR to be high #37

Description

Hi,
I tried to use Arduino Leonardo with the latest Solid Arduino and Standard Firmata 2.5.8., but up to now I had no luck. My Arduino not answered on any command I sent.
The Microsoft Windows Remote Experience was working perfectly.
Then I made some investigation, so I used serial port monitor to find out what happening.
The only difference I realized that Microsoft Windows Remote Experience is turning DTR signal high each time it communicates, but Solid Arduino not.
In the source code of SolidSoils Arduino where the serial port opened I put the following:
base.DtrEnable = true;
Since this change the software is works also with Arduino Leonardo

Activity

  1. bradmartin333 commented on Nov 30, 2022

    Hey @placic - I had the same issue with the Arduino Nano Every. My solution was to add this before calling connection.Open();

    SerialPort p = new(connection.PortName, connection.BaudRate) { DtrEnable = true };
    p.Open();
    Thread.Sleep(250);
    p.Close();

    The delay is important as you need enough time for the arduino to receive the DTR signal and write back.

    Full GetConnection() method:

    private static ISerialConnection? GetConnection(string name)
    {
        ISerialConnection connection = new SerialConnection(name, SerialBaudRate.Bps_57600);
        if (connection == null) Console.WriteLine("No Arduino found");
        else
        {
            try
            {
                // Unfortunate, but have to ping the port to enable coms
                // This is equal to toggling on the Serial Port Monitor in the Arduino IDE
                SerialPort p = new(connection.PortName, connection.BaudRate) { DtrEnable = true };
                p.Open();
                Thread.Sleep(250);
                p.Close();
    
                connection.Open();
                Console.WriteLine($"Connected Arduino at port {connection.PortName}");
            }
            catch (Exception)
            {
                Console.WriteLine($"Cannot connect to arduino on {connection.PortName}. Close open connections and try again.");
                return null;
            }
        }
        return connection;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL