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

335Re: Help on an LED program

Expand Messages
  • navaho4x4
    Feb 3, 2009
      First I would like to start by suggesting java IDE tool like
      eclipse. This will simplify you development.

      Here are issues I spotted:
      LED class already exist in RoboJDE API
      leftRevLEd, rightFwdLed require LED declaration
      display required Display declaration
      an extra closing brace exist at the bottom

      --- In intellibrain@yahoogroups.com, "miss_star_cherry"
      <miss_star_cherry@...> wrote:
      >
      > 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