private void MainPage_Loaded(object sender, RoutedEventArgs e) { usbConnection = new UsbSerial("VID_2A03", "PID_0043"); arduino = new RemoteDevice(usbConnection); arduino.DeviceReady += Arduino_DeviceReady; usbConnection.begin(57600, SerialConfig.SERIAL_8N1); }
public void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("hola"); playing = false; DeviceInformation device = null; var result = UsbSerial.listAvailableDevicesAsync().AsTask <DeviceInformationCollection>().Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first device = result.FirstOrDefault(); } Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(BAUD_RATE, SerialConfig.SERIAL_8N1); }
public async void Start() { var aqs = Windows.Devices.SerialCommunication.SerialDevice.GetDeviceSelector(); var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs); try { var device = devices.Where(x => x.Id.Contains("VID_1A86&PID_7523") || x.Id.Contains("VID_2341&PID_0043")).FirstOrDefault(); Debug.WriteLine("Arduino found: " + device.Name); Debug.WriteLine("Arduino found: " + device.Id); usb = new UsbSerial(device); //arduino = new RemoteDevice(usb); usb.ConnectionEstablished += Usb_ConnectionEstablished; usb.ConnectionFailed += Usb_ConnectionFailed; usb.ConnectionLost += Usb_ConnectionLost; Debug.WriteLine("Begin USB connection"); usb.begin(9600, SerialConfig.SERIAL_8N1); } catch (Exception ex) { } }
private async void grid1_Loaded(object sender, RoutedEventArgs e) { var devices = await UsbSerial.listAvailableDevicesAsync(); int idx = -1; for (int i = 0; i < devices.Count; i++) { if (devices[i].Name.StartsWith("Arduino")) { idx = i; } } if (idx != -1) { usbSerial = new UsbSerial(devices[idx]); firmata = new UwpFirmata(); arduino = new RemoteDevice(firmata); firmata.begin(usbSerial); //arduino.DeviceReady += OnDeviceReady; //usbSerial.ConnectionEstablished += OnDeviceReady; firmata.FirmataConnectionReady += OnDeviceReady; //arduino.SysexMessageReceived += DataRecieved; firmata.SysexMessageReceived += Firmata_SysexMessageReceived; firmata.PinCapabilityResponseReceived += Firmata_PinCapabilityResponseReceived; firmata.DigitalPortValueUpdated += Firmata_DigitalPortValueUpdated; usbSerial.begin(57600, SerialConfig.SERIAL_8N1); } }
private async void Button_Click(object sender, RoutedEventArgs e) { _Serial = new UsbSerial(await FindFirstArduinoBoard()); _Serial.ConnectionEstablished += () => { Debug.WriteLine("Serial connection established"); }; _Serial.ConnectionFailed += (m) => { Debug.WriteLine("Serial connection failed because " + m); }; _Arduino = new RemoteDevice(_Serial); _Arduino.DeviceReady += () => { Debug.WriteLine("Device is ready"); _Arduino.pinMode(12, PinMode.OUTPUT); _Arduino.pinMode(3, PinMode.PULLUP); }; _Arduino.DigitalPinUpdated += (p, s) => { if (p == 3) { _Arduino.digitalWrite(12, s == PinState.HIGH ? PinState.LOW : PinState.HIGH); } ; }; _Serial.begin(57600); }
private void InitWRA() { connection = new UsbSerial("VID_2341", "PID_0043"); arduino = new RemoteDevice(connection); connection.ConnectionEstablished += Connection_ConnectionEstablished; connection.begin(57600, SerialConfig.SERIAL_8N1); }
public MainPage() { this.InitializeComponent(); if (useBluetooth) { /* * I've written my bluetooth device name as a parameter to the BluetoothSerial constructor. You should change this to your previously-paired * device name if using Bluetooth. You can also use the BluetoothSerial.listAvailableDevicesAsync() function to list * available devices, but that is not covered in this sample. */ bluetooth = new BluetoothSerial("RNBT-E072"); arduino = new RemoteDevice(bluetooth); bluetooth.ConnectionEstablished += OnConnectionEstablished; //these parameters don't matter for bluetooth bluetooth.begin(0, 0); } else { /* * I've written my Arduino device VID and PID as a parameter to the BluetoothSerial constructor. You should change this to your * device VID and PID if using USB. You can also use the UsbSerial.listAvailableDevicesAsync() function to list * available devices, but that is not covered in this sample. */ usb = new UsbSerial("VID_2341", "PID_0043"); //I've written in my device D directly arduino = new RemoteDevice(usb); usb.ConnectionEstablished += OnConnectionEstablished; //SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(115200, SerialConfig.SERIAL_8N1); } }
public MainPage() { this.InitializeComponent(); if( useBluetooth ) { /* * I've written my bluetooth device name as a parameter to the BluetoothSerial constructor. You should change this to your previously-paired * device name if using Bluetooth. You can also use the BluetoothSerial.listAvailableDevicesAsync() function to list * available devices, but that is not covered in this sample. */ bluetooth = new BluetoothSerial( "RNBT-E072" ); arduino = new RemoteDevice( bluetooth ); bluetooth.ConnectionEstablished += OnConnectionEstablished; //these parameters don't matter for bluetooth bluetooth.begin( 0, 0 ); } else { /* * I've written my Arduino device VID and PID as a parameter to the BluetoothSerial constructor. You should change this to your * device VID and PID if using USB. You can also use the UsbSerial.listAvailableDevicesAsync() function to list * available devices, but that is not covered in this sample. */ usb = new UsbSerial( "VID_2341", "PID_0043" ); //I've written in my device D directly arduino = new RemoteDevice( usb ); usb.ConnectionEstablished += OnConnectionEstablished; //SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin( 115200, SerialConfig.SERIAL_8N1 ); } }
public Aktivacija() { var usb = new UsbSerial("VID_1A86", "PID_7523"); this.InitializeComponent(); _arduino = new RemoteDevice(usb); _arduino.DeviceReady += Setup; usb.begin(57600, SerialConfig.SERIAL_8N2); }
public void InitializeConnection(string vid, string pid) { //currently hardcoded VID_0403 PID_6001 //usb = new UsbSerial("VID_2341", "PID_0010"); //Arduino available in Lantern usb = new UsbSerial("VID_0403", "PID_6001"); //Arduino available in LCD Printer usb.ConnectionEstablished += OnConnectionEstablished; //usb.begin(250000, SerialConfig.SERIAL_8N1); usb.begin(115200, SerialConfig.SERIAL_8N1); }
public MainPage() { this.InitializeComponent(); UsbSerial connection =new UsbSerial("VID_2341", "PID_0043"); arduino = new RemoteDevice(connection); //just start typing this and you can autocomplete using tab connection.ConnectionEstablished += Connection_ConnectionEstablished; arduino.DeviceReady += TurnOnLight; connection.begin(57600, SerialConfig.SERIAL_8N1); }
// This is there the Arduino connection is set up via // Windows Remote Wiring. The Library is via NuGet private void InitializeWiring() { _serial = new UsbSerial(_vid, _pid); _arduino = new RemoteDevice(_serial); _serial.ConnectionEstablished += OnSerialConnectionEstablished; _serial.begin(57600, SerialConfig.SERIAL_8N1); System.Diagnostics.Debug.WriteLine("Wiring initialized"); }
public MainPage() { this.InitializeComponent(); UsbSerial connection = new UsbSerial("VID_2341", "PID_0043"); arduino = new RemoteDevice(connection); //just start typing this and you can autocomplete using tab connection.ConnectionEstablished += Connection_ConnectionEstablished; arduino.DeviceReady += TurnOnLight; connection.begin(57600, SerialConfig.SERIAL_8N1); }
public Alarm() { Podaci = new List <string>(); Uposlenik = null; ProfilZatvorenika = null; var usb = new UsbSerial("VID_1A86", "PID_7523"); _arduino = new RemoteDevice(usb); _arduino.DeviceReady += Setup; usb.begin(57600, SerialConfig.SERIAL_8N2); }
// Arduino IDer: USB\VID_1A86&PID_7523 public MainPage() { this.InitializeComponent(); connection = new UsbSerial("VID_1A86", "PID_7523"); arduino = new RemoteDevice(connection); arduino.DeviceReady += MyDeviceReadyCallback; arduino.DigitalPinUpdated += ButtonUpdateCallBack; //connection.ConnectionEstablished += OnConnectionEstablished; connection.begin(57600, SerialConfig.SERIAL_8N1); }
public static ArduinoController UsbConnection(DeviceInformation device, uint baudRate = 115200, SerialConfig serialConfig = SerialConfig.SERIAL_8N1) { UsbSerial Connection1 = new UsbSerial(device); Connection1.begin(baudRate, serialConfig); var res = new ArduinoController(Connection1); res.usbConnection = Connection1; res._connType = ConnectionType.Usb; return(res); }
public async Task Setup() { await ExecuteOnMainThread(() => _checkConnectiontimer.Stop()); IsReady = false; await Task.Delay(2000); ConnectionNotify?.Invoke(this, "Tentando se Conectar"); await Task.Delay(2000); if (_bluetoothSerial != null) { Arduino?.Dispose(); Arduino = new RemoteDevice(_bluetoothSerial); await Task.Delay(1000); await ExecuteOnMainThread(() => _bluetoothSerial.begin(57600, SerialConfig.SERIAL_8N1)); } else { Arduino?.Dispose(); Arduino = new RemoteDevice(_usbSerial); await Task.Delay(1000); await ExecuteOnMainThread(() => _usbSerial.begin(57600, SerialConfig.SERIAL_8N1)); } SerialOut = new SerialOutController(Arduino, 12, 8, 7); Arduino.DeviceConnectionLost += message => { ConnectionNotify?.Invoke(this, "Conexão Arduino Perdida: " + message); }; Arduino.DeviceConnectionFailed += async message => { ConnectionNotify?.Invoke(this, "Conexão Arduino Falhou: " + message); await Task.Delay(5000); }; Arduino.DeviceReady += async() => await ArduinoOnDeviceReady(); Servos = new Dictionary <ETinBotServo, ServoController>() { [ETinBotServo.ServoHand] = new ServoController(Arduino, 09), [ETinBotServo.ServoHeadX] = new ServoController(Arduino, 05), [ETinBotServo.ServoHeadY] = new ServoController(Arduino, 06), [ETinBotServo.ServoLeftArm] = new ServoController(Arduino, 03, true), [ETinBotServo.ServoRightArm] = new ServoController(Arduino, 11), [ETinBotServo.ServoTorso] = new ServoController(Arduino, 10) }; await ExecuteOnMainThread(() => _checkConnectiontimer.Start()); }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_003D"); //I've written in my device D directly arduino = new RemoteDevice(usb); usb.ConnectionEstablished += OnConnectionEstablished; //SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(57600, SerialConfig.SERIAL_8N1); }
public PinControl(string VID, string PID, uint BaudRate) { connection = new UsbSerial(VID, PID); baudRate = BaudRate; arduino = new RemoteDevice(connection); connection.begin(baudRate, SerialConfig.SERIAL_8N1); ftp = new Chilkat.Ftp2(); OriginalStates = new string[] { "Off", "Off", "Off", "Off" }; setXML(); }
public MainPage() { this.InitializeComponent(); UsbSerial usb = new UsbSerial("VID_2341", "PID_0043"); arduino = new RemoteDevice(usb); usb.begin(57600, SerialConfig.SERIAL_8N1); }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_8036"); List <ConnectTheDotsSensor> sensors_one = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2198a348-e2f9-4438-ab23-82a3930662ac", "Temperature", "F"), }; List <ConnectTheDotsSensor> sensors_two = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ac", "light", "C"), }; List <ConnectTheDotsSensor> sensors_three = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2398a348-e2f9-4438-ab23-82a3930662ac", "humidity", "Lux"), }; arduino = new RemoteDevice(usb); arduino.DeviceReady += onDeviceReady; usb.begin(57600, SerialConfig.SERIAL_8N1); ctdHelper1 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D1", key: "**********************",//copy the key which come from D1 connection of "ehdevices" displayName: "Temperature", organization: "DFRobot", location: "Shanghai", sensorList: sensors_one); ctdHelper2 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D2", key: "**********************",//copy the key which come from D2 connection of "ehdevices" displayName: "light", organization: "DFRobot", location: "Shanghai", sensorList: sensors_two); ctdHelper3 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D3", key: "**********************",//copy the key which come from D3 connection of "ehdevices" displayName: "humidity", organization: "DFRobot", location: "Shanghai", sensorList: sensors_three); Button_Click(null, null); }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_8036"); //Arduino RemoteDevice Constractor via USB. arduino = new RemoteDevice(usb); //Add DeviceReady callback when connecting successfully arduino.DeviceReady += onDeviceReady; //Baudrate on 57600 and SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(57600, SerialConfig.SERIAL_8N1); }
private async void connect() { dt = new DispatcherTimer() { Interval = new TimeSpan(500) }; dt.Tick += loop; var dev = await UsbSerial.listAvailableDevicesAsync(); foreach (var x in dev) { System.Diagnostics.Debug.WriteLine("Found " + x.Name); } usbcomm = new UsbSerial(dev[0]); arduino = new RemoteDevice(usbcomm); usbcomm.ConnectionEstablished += Comm_ConnectionEstablished; usbcomm.begin(57600, SerialConfig.SERIAL_8N1); }
public void connect() { String VID = Settings.Instance.VID; String PID = Settings.Instance.PID; if (VID != null && PID != null) { UsbSerial usb = new UsbSerial(VID, PID); arduino = new RemoteDevice(usb); usb.begin(57600, SerialConfig.SERIAL_8N1); //"VID_1A86", "PID_7523" } }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_8036"); List<ConnectTheDotsSensor> sensors_one = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2198a348-e2f9-4438-ab23-82a3930662ac", "Temperature", "F"), }; List<ConnectTheDotsSensor> sensors_two = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ac", "light", "C"), }; List<ConnectTheDotsSensor> sensors_three = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2398a348-e2f9-4438-ab23-82a3930662ac", "humidity", "Lux"), }; arduino = new RemoteDevice(usb); arduino.DeviceReady += onDeviceReady; usb.begin(57600, SerialConfig.SERIAL_8N1); ctdHelper1 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D1", key: "**********************",//copy the key which come from D1 connection of "ehdevices" displayName: "Temperature", organization: "DFRobot", location: "Shanghai", sensorList: sensors_one); ctdHelper2 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D2", key: "**********************",//copy the key which come from D2 connection of "ehdevices" displayName: "light", organization: "DFRobot", location: "Shanghai", sensorList: sensors_two); ctdHelper3 = new ConnectTheDotsHelper(serviceBusNamespace: "*********",//choice the serviceBusNamespace at here like "exampleIoT-ns" eventHubName: "ehdevices", keyName: "D3", key: "**********************",//copy the key which come from D3 connection of "ehdevices" displayName: "humidity", organization: "DFRobot", location: "Shanghai", sensorList: sensors_three); Button_Click(null, null); }
public static async Task <RemoteDevice> ConnectDevice() { await Task.Delay(1000); if (connection == null) { var usbDevices = await UsbSerial.listAvailableDevicesAsync(); DeviceInformation info = null; for (int i = 0; i < usbDevices.Count; i++) { var props = usbDevices[i].Properties.Values.ToList(); for (int y = 0; y < props.Count(); y++) { if (props[y] == null) { continue; } if (props[y].ToString().Contains("USB-SERIAL")) { info = usbDevices[i]; break; } } if (info != null) { break; } } if (info == null) { return(null); } connection = new UsbSerial(info); connection.begin(57600, SerialConfig.SERIAL_8N1); } if (arduino == null) { arduino = new RemoteDevice(connection); } return(arduino); }
UsbSerial usb; //Handle the USB connction #endregion Fields #region Constructors public MainPage() { this.InitializeComponent(); //USB VID and PID of the "Arduino Expansion Shield for Raspberry Pi B+" usb = new UsbSerial("VID_2341", "PID_8036"); //Arduino RemoteDevice Constractor via USB. arduino = new RemoteDevice(usb); //Add DeviceReady callback when connecting successfully arduino.DeviceReady += onDeviceReady; //Baudrate on 57600 and SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(57600, SerialConfig.SERIAL_8N1); }
private async void Button_Click(object sender, RoutedEventArgs e) { _Serial = new UsbSerial(await FindFirstArduinoBoard()); _Serial.ConnectionEstablished += () => { Debug.WriteLine("Serial connection established"); }; _Serial.ConnectionFailed += (m) => { Debug.WriteLine("Serial connection failed because " + m); }; _Serial.begin(57600); }
public MainPage() { this.InitializeComponent(); //아두이노와 연결하기 위한 준비. 하드웨어 ID를 이용한다. connection = new UsbSerial("VID_2A03", "PID_0043"); //아두이노 연결하기 arduino = new RemoteDevice(connection); //디바이스 장치 준비. 아두이노의 setup과 같은 역할을 한다. arduino.DeviceReady += Arduino_DeviceReady; //아날로그 핀 업데이트 동작이 생길 시에 진행되는 함수 설정한다. arduino.AnalogPinUpdated += Arduino_AnalogPinUpdated; //아두이노 연결 작업이 성립되었을 때의 동작을 설정한다. connection.ConnectionEstablished += Connection_ConnectionEstablished; //커넥션을 연결한다. connection.begin(57600, SerialConfig.SERIAL_8N1); }
private void connect() { dt = new DispatcherTimer() { Interval = new TimeSpan(500) }; dt.Tick += loop; //useful when running on Raspberry Pi 2 on Windows 10 for IoT //var dev = await UsbSerial.listAvailableDevicesAsync(); //connection = new UsbSerial(dev[0]); connection = new UsbSerial("VID_2341", "PID_0043"); arduino = new RemoteDevice(connection); connection.ConnectionEstablished += Connection_ConnectionEstablished; connection.begin(57600, SerialConfig.SERIAL_8N1); }
public void connect() { String VID = Setting.Instance.VID; String PID = Setting.Instance.PID; if (VID != null && PID != null && !IsConnencion()) { usb = new UsbSerial(VID, PID); arduino = new RemoteDevice(usb); usb.begin(57600, SerialConfig.SERIAL_8N1); if (arduino == null) { var box = new MessageDialog("No Arduino Connected or wrong PID and VID. Please check settings"); box.ShowAsync(); } } }
public MainPage() { this.InitializeComponent(); keys_val[0] = 600; keys_val[1] = 650; keys_val[2] = 700; keys_val[3] = 800; keys_val[4] = 900; //USB VID and PID of the "Arduino Expansion Shield for Raspberry Pi B+" usb = new UsbSerial("VID_2341", "PID_8036"); //Arduino RemoteDevice Constractor via USB. arduino = new RemoteDevice(usb); //Add DeviceReady callback when connecting successfully arduino.DeviceReady += onDeviceReady; textblock.Text = "S1"; //Baudrate on 57600 and SerialConfig.8N1 is the default config for Arduino devices over USB usb.begin(57600, SerialConfig.SERIAL_8N1); }
// Configure and open Arduino connection private void openArduinoConnection() { Debug.WriteLine("IOConnector.openArduinoConnection"); // Configure USB connection usb = new UsbSerial("VID_" + Storage.GetSetting<string>("VID"), "PID_" + Storage.GetSetting<string>("PID")); arduino = new RemoteDevice(usb); // Setup callback functions usb.ConnectionEstablished += Usb_ConnectionEstablished; usb.ConnectionFailed += Usb_ConnectionFailed; usb.ConnectionLost += Usb_ConnectionLost; arduino.DeviceReady += Arduino_DeviceReady; arduino.DeviceConnectionFailed += Arduino_DeviceConnectionFailed; arduino.DeviceConnectionLost += Arduino_DeviceConnectionLost; // Begin arduino connection usb.begin(57600, SerialConfig.SERIAL_8N1); arduinoSignalTimer.Change(10*ARDUINO_ALIVE_TIMER_PERIOD, ARDUINO_ALIVE_TIMER_PERIOD); }
public void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("hi"); // // TODO: Insert code to start one or more asynchronous methods // playing = false; DeviceInformation device = null; var result = UsbSerial.listAvailableDevicesAsync().AsTask <DeviceInformationCollection>().Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first // TODO: Might not be first. device = result.FirstOrDefault(); } WriteLine("device name: " + device.Name); Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(BAUD_RATE, SerialConfig.SERIAL_8N1); // Begin Recording from mic. this.StartRecording(); }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_8036"); List <ConnectTheDotsSensor> sensors_one = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2198a348-e2f9-4438-ab23-82a3930662ac", "Temperature", "F"), }; List <ConnectTheDotsSensor> sensors_two = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ac", "light", "C"), }; List <ConnectTheDotsSensor> sensors_three = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2398a348-e2f9-4438-ab23-82a3930662ac", "humidity", "Lux"), }; arduino = new RemoteDevice(usb); arduino.DeviceReady += onDeviceReady; usb.begin(57600, SerialConfig.SERIAL_8N1); ctdHelper1 = new ConnectTheDotsHelper(iotDeviceConnectionString: "HostName=iot-Plant.azure-devices.net;DeviceId=CalvinsRPI;SharedAccessKey=eYGPHgZ0WfuFFH5tS4hj0wwln2wCO2vMaOdymxP38oc=", organization: "Calvin", location: "Toronto", sensorList: sensors_one); ctdHelper2 = new ConnectTheDotsHelper(iotDeviceConnectionString: "HostName=iot-Plant.azure-devices.net;DeviceId=CalvinsRPI;SharedAccessKey=eYGPHgZ0WfuFFH5tS4hj0wwln2wCO2vMaOdymxP38oc=", organization: "Calvin", location: "Toronto", sensorList: sensors_two); ctdHelper3 = new ConnectTheDotsHelper(iotDeviceConnectionString: "HostName=iot-Plant.azure-devices.net;DeviceId=CalvinsRPI;SharedAccessKey=eYGPHgZ0WfuFFH5tS4hj0wwln2wCO2vMaOdymxP38oc=", organization: "Calvin", location: "Toronto", sensorList: sensors_three); Button_Click(null, null); }
public MainPage() { this.InitializeComponent(); usb = new UsbSerial("VID_2341", "PID_8036"); List <ConnectTheDotsSensor> sensors_one = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2198a348-e2f9-4438-ab23-82a3930662ac", "Temperature", "F"), }; arduino = new RemoteDevice(usb); arduino.DeviceReady += onDeviceReady; usb.begin(57600, SerialConfig.SERIAL_8N1); ctdHelper1 = new ConnectTheDotsHelper(serviceBusNamespace: "exampleiot-ns", //please change this service bus name for you used eventHubName: "ehdevices", keyName: "D1", //change the date channel key: "××××××××××××××××××××××××××××", //please input your key number!! displayName: "Temperature", organization: "DFRobot", location: "Shanghai", sensorList: sensors_one); Button_Click(null, null); }
public ConnectionPage() { playing = false; this.InitializeComponent(); ConnectionMethodComboBox.SelectionChanged += ConnectionComboBox_SelectionChanged; Task <DeviceInformationCollection> task = null; DeviceInformation device = null; task = UsbSerial.listAvailableDevicesAsync().AsTask <DeviceInformationCollection>(); //task.Wait(); var result = task.Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first device = result.FirstOrDefault(); } Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(115200, SerialConfig.SERIAL_8N1); //for (int i = 0; i < 500; i++) // System.Diagnostics.Debug.WriteLine(i); }
public ConnectionPage() { playing = false; this.InitializeComponent(); ConnectionMethodComboBox.SelectionChanged += ConnectionComboBox_SelectionChanged; Task<DeviceInformationCollection> task = null; DeviceInformation device = null; task = UsbSerial.listAvailableDevicesAsync().AsTask<DeviceInformationCollection>(); //task.Wait(); var result = task.Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first device = result.FirstOrDefault(); } Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(115200, SerialConfig.SERIAL_8N1); //for (int i = 0; i < 500; i++) // System.Diagnostics.Debug.WriteLine(i); }
public void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("hola"); playing = false; DeviceInformation device = null; var result = UsbSerial.listAvailableDevicesAsync().AsTask<DeviceInformationCollection>().Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first device = result.FirstOrDefault(); } Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(BAUD_RATE, SerialConfig.SERIAL_8N1); }
public void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("hi"); // // TODO: Insert code to start one or more asynchronous methods // playing = false; DeviceInformation device = null; var result = UsbSerial.listAvailableDevicesAsync().AsTask<DeviceInformationCollection>().Result; if (result == null || result.Count == 0) { throw new InvalidOperationException("No USB FOUND"); } else { // Assume first // TODO: Might not be first. device = result.FirstOrDefault(); } WriteLine("device name: " + device.Name); Connection = new UsbSerial(device); Firmata = new UwpFirmata(); Firmata.begin(Connection); Arduino = new RemoteDevice(Firmata); Connection.ConnectionEstablished += OnConnectionEstablished; Connection.begin(BAUD_RATE, SerialConfig.SERIAL_8N1); // Begin Recording from mic. this.StartRecording(); }