Home→Forums→MonoBrick EV3 Firmware→controlling the engine→Reply To: controlling the engine
September 9, 2014 at 17:21
#4845
Anders Søborg
Keymaster
Hi
I think that you are doing something wrong. The code below works fine…
using System;
using MonoBrickFirmware;
using MonoBrickFirmware.Display.Dialogs;
using MonoBrickFirmware.Display;
using MonoBrickFirmware.Movement;
using System.Threading;
namespace MonoBrickHelloWorld
{
class MainClass
{
private const float P = 0.8f;
private const float I = 1800.1f;
private const float D = 0.5f;
public static void Main (string[] args)
{
Motor a = new Motor(MotorPort.OutA);
PositionPID PID = new PositionPID(a,1000, true, 50, P,I,D, 500);
PID.Run().WaitOne();
LcdConsole.WriteLine(a.GetTachoCount().ToString());
PID = new PositionPID(a,-1000, true, 50, P,I,D, 500);
PID.Run().WaitOne();
LcdConsole.WriteLine(a.GetTachoCount().ToString());
}
}
}
/Anders
Follow