0

I have a Leonardo with a Yun shield, and I would like to be able to control the arduino with a windows form app, but thats besides the point for now at least. Currently, I am using putty and the commands Telnet Localhost 6571. However, I would like to avoid doing that and I was wondering if anybody new how to communicate with the arduino from port 22 at the yun's IP, rather than connecting to the yun and then to the remote local machine. That or I am missing something entirely!

This is the code I am using to try and access the console port of the Leonardo:

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            //connect to arduino 
            ConnectionInfo ConnNfo = new ConnectionInfo("10.1.1.211", 22, "root", new AuthenticationMethod[] { new PasswordAuthenticationMethod("root", "123456789") });
            using (var sshclient = new SshClient(ConnNfo))
            {
                sshclient.Connect();
                //connect to console port of arduino
                TcpClient tcp = new TcpClient("localhost", 5671);
                sshclient.Disconnect();
            }
            Console.ReadKey();
        }
    }
}

Thank you

1

The console port is only listening on 127.0.0.1 (for security), so only the Yun itself can connect to the console.

You can weaken security and open the port up to the entire local network by editing the file /usr/lib/python2.7/bridge/console.py and change the value 127.0.0.1 to 0.0.0.0.

Any machine on your local network will then be able to connect directly to port 6571.

  • Thanks for the help, how would I connect to that port via my pc without using Telnet, I edited the file as per your instructions. – JackCage Aug 28 '17 at 5:26
  • You can use putty in telnet mode to connect direct to the port. – Majenko Aug 28 '17 at 8:18
  • Alternatively you can write your own software in whatever language you prefer to open a TCP connection directly and use it as if it were a serial port. – Majenko Aug 28 '17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.