private void ArduinoSetup() { ledON = false; toggleLED.BackColor = Color.Red; serialPort = new ArduinoSerialPort("COM5", 115200); serialPort.Open(); cwAnalogPinMapping = new PinMapping(11); ccwAnalogPinMapping = new PinMapping(10); pinMapping = new PinMapping(13); eStop = new PinMapping(8); serialPort.ComponentMappings.Add(cwAnalogPinMapping); serialPort.ComponentMappings.Add(ccwAnalogPinMapping); serialPort.ComponentMappings.Add(pinMapping); serialPort.ComponentMappings.Add(eStop); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); pinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPinMode(SetPinModeStateCodes.OutputStateCode); pinMapping.FeedbackEvent += new SkynetUtilities.FeedbackRecievedEventHandler(ResponsePackageRecieved); this.replyPackageTextBox.Text = "0"; eStop.SetPin(true); stopped = false; }
private void button1_Click(object sender, EventArgs e) { stopped = !stopped; eStop.SetPin(!stopped); if (stopped) { button1.BackColor = Color.Red; } else { button1.BackColor = Color.Green; } }
public void InitializeArduino() { serialPort = new ArduinoSerialPort("COM5", 115200); serialPort.Open(); cwAnalogPinMapping = new PinMapping(11); ccwAnalogPinMapping = new PinMapping(10); eStop = new PinMapping(8); serialPort.ComponentMappings.Add(cwAnalogPinMapping); serialPort.ComponentMappings.Add(ccwAnalogPinMapping); serialPort.ComponentMappings.Add(eStop); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPin(true); }
public void GestureCaptured(bool captured) { cwAnalogPinMapping.SetPin(captured ? 255 : 0); ccwAnalogPinMapping.SetPin(0); }
private void ToggleLED(bool on) { pinMapping.SetPin(on); }
private void analogGoButton_Click(object sender, EventArgs e) { cwAnalogPinMapping.SetPin(Convert.ToInt32(cwAnalogIntensityTextBox.Text)); ccwAnalogPinMapping.SetPin(Convert.ToInt32(ccwAnalogIntensityTextBox.Text)); }