Example #1
0
        private static SafeSerialPort ConnectToArduboy(string arduboy)
        {
            var s = new SafeSerialPort()
            {
                BaudRate  = 115200,
                PortName  = arduboy,
                RtsEnable = true,
            };

            s.Open(true);
            s.DataReceived += S_DataReceived;
            Log("Connected to " + s.PortName);
            TimeSinceLastPingReceived.Restart();
            Ping(s); // Initial ping
            return(s);
        }
Example #2
0
        /// <summary>
        /// Send reset signal via opening and closing the port at 1200 bauds
        /// </summary>
        /// <param name="port">COM port</param>
        private static void SendReset(string port)
        {
            var arduboy = new SafeSerialPort
            {
                BaudRate  = 1200,
                PortName  = port,
                DtrEnable = true
            };

            arduboy.Open();

            while (!arduboy.IsOpen)
            {
                Thread.Sleep(100);
            }

            arduboy.DtrEnable = false;
            arduboy.Close();
            arduboy.Dispose();
        }