public MainPage() { this.InitializeComponent(); _servoDriver = new ServoDriver(18, new ServoPulseModel { ForwardPulseWidth = 2, BackwardPulseWidth = 1, PulseFrequency = 20 }); _ledDriver = new LedDriver(4); _connection = new HubConnection("http://ipwebapp.azurewebsites.net/"); _hubProxy = _connection.CreateHubProxy("bandHub"); _hubProxy.On <string>("sendData", x => { if (x == "left") { _servoDriver.Clockwise(); } else if (x == "right") { _servoDriver.CounterClockwise(); } }); _connection.Start().Wait(); }
private void Button_Click_Left(object sender, RoutedEventArgs e) { _servoDriver.Clockwise(); }