public async void ExecuteAnalogWrite_Click(object sender, EventArgs e) { OperationsPanel.Enabled = false; CredentialsPanel.Enabled = false; Response.Text = "Waiting for response.."; Status.Text = "Executing.."; Bolt myBolt = new Bolt(ApiKey.Text.Trim(), DeviceId.Text.Trim()); string pin = ""; switch (AnalogWritePinSel.SelectedIndex) { case 0: pin = DigitalPins.D0; break; case 1: pin = DigitalPins.D1; break; case 2: pin = DigitalPins.D2; break; case 3: pin = DigitalPins.D3; break; case 4: pin = DigitalPins.D4; break; } RequestURL.Text = BuildRequestUrl("analogWrite", new List <string> { "pin", "value" }, new List <string> { pin, AnalogWriteValue.Value.ToString() }); Response response = await myBolt.AnalogWrite(pin, (int)AnalogWriteValue.Value); Response.Text = response.ResponseString; Status.Text = "Ready"; OperationsPanel.Enabled = true; CredentialsPanel.Enabled = true; }