public Servo(int servoNum, serHandler serHandler, int servoPos = 1500, int offset = 0, bool active = false) { _ServoHandler = serHandler; _Active = active; _ServoNumber = servoNum; // Servo position and offset is stored in microseconds (uS) _ServoPosition = servoPos; _Offset = offset; }
public Controller(int servos = 32) { _SerialHandler = new serHandler(); var timeout = DateTime.Now; while( !(_SerialHandler.serOpen || DateTime.Now - timeout > new TimeSpan(0, 1, 10))) { Thread.Sleep(10); } if (!_SerialHandler.serOpen) { Console.WriteLine("Connection to Servotor failed. No robot movement will occur."); } Console.WriteLine("initializing servos"); Servos = new Servo[servos]; for (int i = 0; i < servos; i++) { Servos[i] = new Servo(i, _SerialHandler); Servos[i].kill(); } }