Beispiel #1
0
  public void WRITE() {
    if (writeEnable == false) return;

    myPort.write("h");

    myPort.write(PApplet.parseInt(PitchP.value() * 100));
    myPort.write(PApplet.parseInt(RollP.value() * 100));
    myPort.write(PApplet.parseInt(YawP.value() * 100));

    myPort.write(PApplet.parseInt(PitchD.value() * 100));
    myPort.write(PApplet.parseInt(RollD.value() * 100));
    myPort.write(PApplet.parseInt(YawD.value() * 100));

    myPort.write(PApplet.parseInt(PitchPWR.value()));
    myPort.write(PApplet.parseInt(RollPWR.value()));
    myPort.write(PApplet.parseInt(YawPWR.value()));

    myPort.write(RCcontrol);
    myPort.write(YawRCon);

    myPort.write(PApplet.parseInt(RollCal.value() * 10 + 100));
    // println (RollCal.value());
    // println (int (RollCal.value()*10+100));

    readStatus = "Write OK";
  }
Beispiel #2
0
  public void draw() {
    // String Serial.list()[];
    // size(600, 280);
    // background(80);

    fill(70);
    strokeWeight(0);
    stroke(35); // 75
    rect(0, 80, 600, 155, 0);

    fill(70);
    strokeWeight(0);
    stroke(35);
    rect(440, 80, 600, 155, 0);

    fill(75);
    strokeWeight(0);
    stroke(80);
    rect(0, 240, 600, 100, 0);

    fill(255);

    // Background
    // setGradient(0, 0, width, 80, c2, c1, Y_AXIS);

    textSize(12);
    text("Pitch P:", 35, 112);
    textSize(12);
    text("Pitch D:", 155, 112);

    textSize(12);
    text("Roll P:", 38, 162);
    textSize(12);
    text("Roll D:", 158, 162);

    textSize(12);
    text("Yaw P:", 38, 211);
    textSize(12);
    text("Yaw D:", 158, 211);

    textSize(12);
    text("Pitch Power:             %", 301, 112);
    textSize(12);
    text("Roll Power:             %", 307, 162);
    textSize(12);
    text("Yaw Power:             %", 305, 212);

    textSize(12);
    text("Roll Calibration (degr.)", 460, 190);

    textSize(16);
    // fill(0, 102, 153, 204);
    // text("Connected to:",400,45); text(Serial.list()[0],515,45);
    // text("Connected to:",400,45); text(Serial.list()[1],515,65);
    // text("Connected to:",400,45); text(Serial.list()[2],515,65);

    if (printlist == true) {
      for (int i = 0; i <= commListMax; i++) {
        text(Serial.list()[i], 515, 21 + i * 25);
      }
      printlist = false;
    }

    textSize(12);
    text(readStatus, 110, 263);

    if (PitchP.value() == 0) PitchP.setValue(0.01f);
    if (RollP.value() == 0) RollP.setValue(0.01f);
    if (YawP.value() == 0) YawP.setValue(0.01f);

    if (PitchD.value() == 0) PitchD.setValue(0.01f);
    if (RollD.value() == 0) RollD.setValue(0.01f);
    if (YawD.value() == 0) YawD.setValue(0.01f);

    if (PitchPWR.value() == 0) PitchPWR.setValue(1);
    if (RollPWR.value() == 0) RollPWR.setValue(1);
    if (YawPWR.value() == 0) YawPWR.setValue(1);

    // if(RollCal.value()==-9.9)RollCal.setValue(-9.9);

  }