Loading ...
Sorry, an error occurred while loading the content.

334Help on an LED program

Expand Messages
  • miss_star_cherry
    Feb 3, 2009
      Hi. I have a program that I have been working on that needs fine
      tuning. It keeps finding one syntax error that says there is an extra
      brace, but when I remove it, there are seven problems.
      Can anyone look over this and let me know what I did wrong?





      The program:

      import com.ridgesoft.intellibrain.IntelliBrain;
      import com.ridgesoft.robotics.Motor;
      import com.ridgesoft.robotics.ContinuousRotationServo;
      import com.ridgesoft.io.Display;
      import com.ridgesoft.io.LED;

      public class LED {
      private static Motor left;
      private static Motor right;
      private static int i;
      private static LED leftFwdLED;
      private static LED leftRevLED;
      private static LED rightFwdLED;
      private static LED rightRevLED;
      public static void main(String args[]) {
      leftFwdLED = IntelliBrain.getUserLed(1);
      leftRevLEd = IntelliBrain.getUserLed(2);
      rightFwdLed = IntelliBrain.getUserLed(3);
      rightRevLED = IntelliBrain.getUserLed(4);
      display = IntelliBrain.getLcdDisplay();
      i = 0;
      left =
      new ContinuousRotationServo(IntelliBrain.getServo(1), false, 16);
      right =
      new ContinuousRotationServo(IntelliBrain.getServo(2), true, 16);
      display.print(0, "Begin");

      }
      public static void goForward() {
      left.setPower(16);
      right.setPower(16);
      }
      public static void rotate() {
      left.setPower(16);
      right.setPower(-16);
      }
      public static void stop () {
      left.stop();
      right.stop();
      }
      public static void go(int leftPower, int rightPower, int milliseconds) {
      left.setPower(leftPower);
      right.setPower(rightPower);
      try {
      Thread.sleep(milliseconds);
      }
      catch (InterruptedException e){}
      }
      public static void maneuverSquare(int size) {
      for (int i = 0; i < 4; i ++){
      go(16, 16, size);
      go(16, -16, 500);
      }
      }
      }
      }
    • Show all 5 messages in this topic