当前位置: 首页>>代码示例>>C#>>正文


C# IStream.begin方法代码示例

本文整理汇总了C#中IStream.begin方法的典型用法代码示例。如果您正苦于以下问题:C# IStream.begin方法的具体用法?C# IStream.begin怎么用?C# IStream.begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStream的用法示例。


在下文中一共展示了IStream.begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitFirmata

    private void InitFirmata()
    {
      //USB\VID_2A03&PID_0043&REV_0001
      //create a serial connection
      //var devices = await UsbSerial.listAvailableDevicesAsync();
      //var devList = devices.ToList();

      serial = new UsbSerial("VID_2A03", "PID_0043");

      //construct the firmata client
      firmata = new UwpFirmata();
      firmata.FirmataConnectionReady += Firmata_FirmataConnectionReady;
      firmata.StringMessageReceived += Firmata_StringMessageReceived;

      //last, construct the RemoteWiring layer by passing in our Firmata layer.
      arduino = new RemoteDevice(firmata);
      arduino.DeviceReady += Arduino_DeviceReady;

      //if you create the firmata client yourself, don't forget to begin it!
      firmata.begin(serial);

      //you must always call 'begin' on your IStream object to connect.
      //these parameters do not matter for bluetooth, as they depend on the device. However, these are the best params to use for USB, so they are illustrated here
      serial.begin(57600, SerialConfig.SERIAL_8N1);

    }
开发者ID:BretStateham,项目名称:GrokingFirmata,代码行数:26,代码来源:MainPage.xaml.cs

示例2: Arduino_Connect

 private async void Arduino_Connect()
 {
     arduinoConnected = false;
     ArduinoConnectionStatusText.Text = "Connecting...";
     arduinoConnection = new BluetoothSerial( "RNBT-773E" );
     arduino = new RemoteDevice( arduinoConnection );
     arduino.DeviceReady += Arduino_DeviceReady;
     arduino.DeviceConnectionFailed += Arduino_DeviceConnectionFailed;
     arduino.DeviceConnectionLost += Arduino_DeviceConnectionLost;
     arduinoConnection.begin( 115200, SerialConfig.SERIAL_8N1 );
 }
开发者ID:turkycat,项目名称:band-controlled-car,代码行数:11,代码来源:MainPage.xaml.cs

示例3: Page_Loaded

        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var devices = await UsbSerial.listAvailableDevicesAsync();

            if (!devices.Any())
            {
                var dialog = new MessageDialog("There is no device connected");
                await dialog.ShowAsync();
                return;
            }

            connection = new UsbSerial(devices.First());
            arduino = new RemoteDevice(connection);

            arduino.DeviceReady += Setup;

            connection.begin(57600, SerialConfig.SERIAL_8N1);
        }
开发者ID:Fredi,项目名称:ArduinoLight,代码行数:18,代码来源:MainPage.xaml.cs

示例4: Init

        public static async void Init()
        {
            var deviceList = await UsbSerial.listAvailableDevicesAsync();
            var device = deviceList.First();
            connection = new UsbSerial(device);
            firmata = new UwpFirmata();
            firmata.begin(connection);
            App.Arduino = new RemoteDevice(firmata);

            connection.ConnectionEstablished += OnConnectionEstablished;
            connection.ConnectionFailed += OnConnectionFailed;
            connection.begin(115200, SerialConfig.SERIAL_8N1);

            //start a timer for connection timeout
            timeout = new DispatcherTimer();
            timeout.Interval = new TimeSpan(0, 0, 30);
            timeout.Tick += Connection_TimeOut;
            timeout.Start();
        }
开发者ID:frcepeda,项目名称:LED-Simon-oneweek,代码行数:19,代码来源:LEDStrip.cs

示例5: btnConnect_Click

        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            Helpers.OutputTextBox = txtMessages;
            Helpers.ShowMessage("About to Connect");

            // *** IMPORTANT ***
            // You need to add the VID and PID for your device.
            // I'll post screen shots of finding it on my blog
            // at http://MosesSoftware.com
            //
            // NOTE: The line below is, obviously, for a USB cnnected
            // device.  You can also use a BlueTooth.
            connection = new UsbSerial("VID_2341", "PID_0042");
            arduino = new RemoteDevice(connection);
            arduino.DeviceReady += OnDeviceReady;
            arduino.AnalogPinUpdated += OnAnalogPinUpdated;
            arduino.DeviceConnectionFailed += OnDeviceConnectionFailed;
            arduino.DeviceConnectionLost += OnDeviceConnectionLost;
            arduino.DigitalPinUpdated += OnDigitialPinUpdated;
            arduino.StringMessageReceived += OnStringMessageReceived;
            arduino.SysexMessageReceived += OnSysexMessageReceived;
            arduino.I2c.I2cReplyEvent += OnI2CReplyEvent;

            // *** IMPORTANT ***
            // Make sure the baud rate is the same as the one specified
            //  in the Firmata program uploaded to the arduino.
            connection.begin(57600, SerialConfig.SERIAL_8N1);
        }
开发者ID:WCMoses,项目名称:Win10-Universal-IoT-Arduino-Samples,代码行数:28,代码来源:MainPage.xaml.cs


注:本文中的IStream.begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。