public void Execute(IArduino arduino) { var leftWheel = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low); var rightWheel = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low); arduino.Send(rightWheel); arduino.Send(leftWheel); }
public void Execute(IArduino arduino) { var redLight = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low); var greenLight = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low); arduino.Send(redLight); arduino.Send(greenLight); }
public async Task Execute(IArduino arduino) { var leftWheelOn = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.High); var leftWheelOff = new DigitalWriteRequest(1, ArduinoDriver.DigitalValue.Low); var rightWheelOn = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.High); var rightWheelOff = new DigitalWriteRequest(2, ArduinoDriver.DigitalValue.Low); Task delay = Task.Delay(2000); Task task1 = new Task(async() => { arduino.Send(leftWheelOff); arduino.Send(rightWheelOn); }); Task task2 = new Task(async() => { arduino.Send(leftWheelOn); arduino.Send(rightWheelOn); }); await task1; await delay; await task2; }