BrianPeek / legoev3

LEGO MINDSTORMS EV3 API for .NET
Apache License 2.0
137 stars 72 forks source link

continous drive #13

Open nowark opened 8 years ago

nowark commented 8 years ago

Hello, First of all, great job creating this API. I am new to programming so please be patient if i ask wrong question.

  1. I had sed this api for 2 monh already and stopped yesterday. The problem is a don't know how to write a command to drive continuously. I mean that i know how to write a command to drive forward or backward for time and with power. But is there a way that iam mising to write a method that command to drive some time forward then turn left and then go forward for some time. I fought that if i create a button and add a code for example"

private void Button1Clicked(object sender, RoutedEventArgs routedEventArgs) { await brick.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A | OutputPort.B, 50, 5000); await brick.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A, 50, 5000); await brick.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A | OutputPort.B, 50, 5000); } The brick only see a one command and dont do all of them.

  1. i wrote sth like this:

private void Button2Clicked(object sender, RoutedEventArgs routedEventArgs) { if(TextBox1.Text == "1") GoForward(); // method for going forward for some time else if(TextBox1.Text == "2") GoBackward(); }

it worked when i used textbox and write something on it. But how to use a data from sensor so it can behave deiferently. I tried to figure out how to do it from other language but i dont have knowlege to do so.

I will be very greatefull if anyone can help me with this.