Exemple #1
0
 public ServoViewModel(int number, Servo servo)
 {
     _Servo = servo;
     ServoNumber = number;
     ServoActive = false;
     ServoMinPosition = 500;
     ServoMaxPosition = 2500;
     ServoPosition = 1500;
 }
Exemple #2
0
 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();
     }
 }