コード例 #1
0
        public static ArduinoController NetworkConnection(HostName host, ushort port, uint baudRate = 115200, SerialConfig serialConfig = SerialConfig.SERIAL_8N1)
        {
            NetworkSerial Connection1 = new NetworkSerial(host, port);
            var           res         = new ArduinoController(Connection1);

            Connection1.begin(baudRate, serialConfig);
            res.networkConnection = Connection1;
            res._connType         = ConnectionType.Network;
            return(res);
        }
コード例 #2
0
        private void InitWRA()
        {
            string svr = txtIP.Text;

            connection = new NetworkSerial(new HostName(svr), 3030);
            arduino    = new RemoteDevice(connection);

            arduino.DeviceConnectionLost += Arduino_DeviceConnectionLost;

            connection.ConnectionEstablished += Connection_ConnectionEstablished;
            connection.ConnectionFailed      += Connection_ConnectionFailed;

            connection.begin(115200, SerialConfig.SERIAL_8N1);
        }
コード例 #3
0
        public async Task <bool> Connect(string host, ushort port)
        {
            if (String.IsNullOrWhiteSpace(host))
            {
                throw new ArgumentException("Please provide hostname", nameof(host));
            }

            _connection = new NetworkSerial(new Windows.Networking.HostName(host), port);
            _arduino    = new RemoteDevice(_connection);

            _connection.ConnectionEstablished += _connection_ConnectionEstablished;
            _connection.ConnectionFailed      += _connection_ConnectionFailed;
            _arduino.DeviceReady += _arduino_DeviceReady;
            _connection.begin(115200, SerialConfig.SERIAL_8N1);
            return(true);
        }
コード例 #4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            // Create Firmata
            this.mkr1000_firmata = new UwpFirmata();

            //Create MKR1000 Device
            mkr1000 = new Microsoft.Maker.RemoteWiring.RemoteDevice(mkr1000_firmata);

            //Establish a network serial connection. change it to the right IP address and port
            wificonnection = new Microsoft.Maker.Serial.NetworkSerial(new Windows.Networking.HostName("192.168.1.42"), 3030);

            //Attach event handlers
            wificonnection.ConnectionEstablished += NetWorkSerial_ConnectionEstablished;
            wificonnection.ConnectionFailed += NetWorkSerial_ConnectionFailed;

            //Begin Firmata
            mkr1000_firmata.begin(wificonnection);

            //Begin connection
            wificonnection.begin(115200, Microsoft.Maker.Serial.SerialConfig.SERIAL_8N1);
        }
コード例 #5
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            // Create Firmata
            this.mkr1000_firmata = new UwpFirmata();

            //Create MKR1000 Device
            mkr1000 = new Microsoft.Maker.RemoteWiring.RemoteDevice(mkr1000_firmata);

            //Establish a network serial connection. change it to the right IP address and port
            wificonnection = new Microsoft.Maker.Serial.NetworkSerial(new Windows.Networking.HostName("192.168.1.42"), 3030);

            //Attach event handlers
            wificonnection.ConnectionEstablished += NetWorkSerial_ConnectionEstablished;
            wificonnection.ConnectionFailed      += NetWorkSerial_ConnectionFailed;

            //Begin Firmata
            mkr1000_firmata.begin(wificonnection);

            //Begin connection
            wificonnection.begin(115200, Microsoft.Maker.Serial.SerialConfig.SERIAL_8N1);
        }