コード例 #1
0
ファイル: t5-s-slavecomplete.java プロジェクト: jd7h/des
  public static void Measurement() {
    // execute all actions of this state
    LCD.drawString("Measurement", 0, 3);
    btThread.popElement();
    Sound.beep();
    Sound.beep();
    // lower sensor by RCX motor
    tempMotor.setPower(-100);
    tempMotor.setPower(0);
    for (int i = 0; i < nrcolors; i++) {
      if (colorsens.getColorID() == lakes[i].color && !lakes[i].found) // kleuren komen overeen
      lakes[i].celsius = tempSensor.getCelcius();
      lakes[i].found = true;
      return;
    }
    // raise temp sensor
    tempMotor.setPower(100);
    btThread.write(500); // sends the message 'action done'

    // leg de huidige tijd vast voor alle transitions met een timeoutcondition
    long starttime = System.currentTimeMillis();

    // when done, wait for a trigger for a transition
    boolean transitionTaken = false;
    while (!transitionTaken) {
      if ((lakes[0].found && lakes[1].found && lakes[2].found)) {
        current = State.FINISHED;
        transitionTaken = true;
      } else if ((true)) {
        current = State.WATCH;
        transitionTaken = true;
      }
    }
  }
コード例 #2
0
ファイル: t5-s-slavecomplete.java プロジェクト: jd7h/des
 public static void Finished() {
   // execute all actions of this state
   LCD.drawString("Finished", 0, 3);
   Sound.beep();
   Sound.beep();
   Sound.beep();
   btThread.write(300); // sends the message 'all done'
 }
コード例 #3
0
ファイル: t5-s-slavecomplete.java プロジェクト: jd7h/des
  public static void Sonarflag() {
    // execute all actions of this state
    LCD.drawString("Sonarflag", 0, 3);
    Sound.beep();
    btThread.write(sonar.getDistance()); // sends the data from the sonar

    // leg de huidige tijd vast voor alle transitions met een timeoutcondition
    long starttime = System.currentTimeMillis();

    // when done, wait for a trigger for a transition
    boolean transitionTaken = false;
    while (!transitionTaken) {
      if ((true)) {
        current = State.WATCH;
        transitionTaken = true;
      }
    }
  }
コード例 #4
0
ファイル: t5-s-slavecomplete.java プロジェクト: jd7h/des
  public static void Colorflag() {
    // execute all actions of this state
    LCD.drawString("Colorflag", 0, 3);
    Sound.beep();
    btThread.write(400); // sends the message 'new color found'

    // leg de huidige tijd vast voor alle transitions met een timeoutcondition
    long starttime = System.currentTimeMillis();

    // when done, wait for a trigger for a transition
    boolean transitionTaken = false;
    while (!transitionTaken) {
      if ((starttime + 30000 <= System.currentTimeMillis())) {
        current = State.WATCH;
        transitionTaken = true;
      } else if ((btThread.peekElement() == 500)) {
        current = State.MEASUREMENT;
        transitionTaken = true;
      }
    }
  }