peony3000

Gadgeteer Servo Code Bugged

Apr 17th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1.  Debug.Print("Program Started");
  2.             GT.Interfaces.PWMOutput servo = this.extender.SetupPWMOutput(GT.Socket.Pin.Seven);//Servo motor 1 defined to PWM pin 7
  3.             servo.Active = true;// seems to just turn the servo 'on'
  4.  
  5.             GT.Interfaces.PWMOutput servo1 = this.extender.SetupPWMOutput(GT.Socket.Pin.Eight);//Servo motor 1 defined to PWM pin 7  
  6.             servo1.Active = true;// seems to just turn the servo 'on'
  7.  
  8.             GT.Interfaces.PWMOutput servo2 = this.extender.SetupPWMOutput(GT.Socket.Pin.Nine);//Servo motor 1 defined to PWM pin 7  
  9.             servo2.Active = true;// seems to just turn the servo 'on'
  10.  
  11.             while (1 == 1)
  12.             {
  13.                
  14.                  for (UInt32 hightime = 600; hightime <= 2000; hightime += 72)   // got this part online - can't figure out what it actually does, somehoe difines the range of the servos from 600 to 2000      
  15.                  {
  16.                   servo.SetPulse(20 * 1000 * 1000, hightime * 1000); // From what I gather the first bit is the pulse speed in miliseconds, and the second the strength of the pulse
  17.  
  18.                   System.Threading.Thread.Sleep(100);
  19.  
  20.                   servo1.SetPulse(20 * 1000 * 1000, hightime * 1000);
  21.  
  22.                   System.Threading.Thread.Sleep(100);
  23.  
  24.                   servo2.SetPulse(20 * 1000 * 1000, hightime * 1000);
  25.  
  26.                   System.Threading.Thread.Sleep(100);
  27.  
  28.                   Debug.Print("High Time= " + hightime.ToString());
Advertisement
Add Comment
Please, Sign In to add comment