Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Error Compiling for Arduino/Genuino

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    8

    Error Compiling for Arduino/Genuino

    When trying to verify this code in Arduino I keep getting this error message "Error compiling for Arduino/Genuino exit status 1" the code is shown below.

    #include <VirtualWire.h>
    #include <ServoTimer2.h>
    #include <Servo.h>
    // Declare Sevor Objects
    ServoTimer2 finger1;
    ServoTimer2 finger2;
    ServoTimer2 finger3;
    ServoTimer2 finger4;
    ServoTimer2 finger5;
    // Declare signal inputs
    int flex_signal1;
    int flex_signal2;
    int flex_signal3;
    int flex_signal4;
    int flex_signal5;
    // Callibrated MIN MAX valuse for the flex resistors
    int F1MIN=320;
    int F1MAX=470;
    int F2MIN=250;
    int F2MAX=400;
    int F3MIN=350;
    int F3MAX=450;
    int F4MIN=325;
    int F4MAX=465;
    int F5MIN=275;
    int F5MAX=425;

    //Setup
    void setup() {

    Serial.begin(9600);
    finger1.attach(9);
    finger2.attach(10);
    finger3.attach(11);
    finger4.attach(12);
    finger5.attach(13);

    vw_set_ptt_inverted(true); // Required for RF Link module
    vw_setup(400); // 400 Bits per sec
    vw_set_tx_pin(12); // pin 12 is used as the transmit data out into the TX Link module
    vw_set_rx_pin(11); // pin 11 is used as the transmit data out into the TX Link
    module vw_rx_start(); // Start the receiver

    }
    void loop() {

    // Buffer that holds the data received
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    // check to see if anything has been received
    if (vw_get_message(buf, &buflen)) {

    // Data trimming
    flex_signal1 = constrain(buf[0], F1MIN, F1MAX);
    flex_signal2 = constrain(buf[2], F2MIN, F2MAX);
    flex_siganl3 = constrain(buf[4], F3MIN, F3MAX);
    flex_signal4 = constrain(buf[6], F4MIN, F4MAX);
    flex_signal5 = constrain(buf[8], F5MIN, F5MAX);

    // Maps the values from the flex resistor to control signals of the motor
    int controlFinger1 = map(flex_signal1, F1MIN, F1MAX, 180, 0);
    int controlFinger2 = map(flex_signal2, F2MIN, F2MAX, 180, 0);
    int controlFinger3 = map(flex_signal3, F3MIN, F3MAX, 180, 0);
    int controlFinger4 = map(flex_signal4, F4MIN, F4MAX, 180, 0);
    int controlFinger5 = map(flex_signal5, F5MIN, F5MAX, 180, 0);
    finger1.write(controlFinger1);
    finger2.write(controlFinger2);
    finger3.write(controlFinger3);
    finger4.write(controlFinger4);
    finger5.write(controlFinger5);
    //Monitor values through serial monitos
    Serial.print("flex1: ");
    Serial.print(flex_signal1);
    Serial.print("flex2: ");
    Serial.print(flex_signal2);
    Serial.print("flex3: ");
    Serial.print(flex_signal3);
    Serial.print("flex4: ");
    Serial.print(flex_signal4);
    Serial.print("flex5: ");
    Serial.print(flex_signal5);
    Serial.print(" motor1: ");
    Serial.print(controlFinger1);
    Serial.print(" motor2: ");
    Serial.print(controlFinger2);
    Serial.print(" motor3: ");
    Serial.print(controlFinger3);
    Serial.print(" motor4: ");
    Serial.print(controlFinger4);
    Serial.print(" motor5: ");
    Serial.print(controlFinger5);
    }

    }

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,080
    That message is just a summary at the end. The real error message occurred somewhere before that.
    The real error was probably complaining about this typo:
    Code:
    flex_siganl3 = constrain(buf[4], F3MIN, F3MAX);
    Which Teensy are you using?

    Pete

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    8
    Teensy 3.2 however, even after correcting the misspelling of signal the error still occurs

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,059
    Did you write this code? Or just find it somewhere online? Maybe tell us the source, so we can understand it better?

    In addition to the typo, this code also has the word "module" at the beginning of a line, when it was probably meant to be part of a comment on the previous line.

    It also uses a library named "ServoTimer2", which does not exist for Teensy.

    Here is a copy with all these problems fixed. I just verified that it does indeed compile for Teensy 3.2.

    Code:
    #include <VirtualWire.h>
    #include <Servo.h>
    // Declare Sevor Objects
    Servo finger1;
    Servo finger2;
    Servo finger3;
    Servo finger4;
    Servo finger5;
    // Declare signal inputs
    int flex_signal1;
    int flex_signal2;
    int flex_signal3;
    int flex_signal4;
    int flex_signal5;
    // Callibrated MIN MAX valuse for the flex resistors
    int F1MIN = 320;
    int F1MAX = 470;
    int F2MIN = 250;
    int F2MAX = 400;
    int F3MIN = 350;
    int F3MAX = 450;
    int F4MIN = 325;
    int F4MAX = 465;
    int F5MIN = 275;
    int F5MAX = 425;
    
    //Setup
    void setup() {
    
      Serial.begin(9600);
      finger1.attach(9);
      finger2.attach(10);
      finger3.attach(11);
      finger4.attach(12);
      finger5.attach(13);
    
      vw_set_ptt_inverted(true); // Required for RF Link module
      vw_setup(400); // 400 Bits per sec
      vw_set_tx_pin(12); // pin 12 is used as the transmit data out into the TX Link module
      vw_set_rx_pin(11); // pin 11 is used as the transmit data out into the TX Link module
      vw_rx_start(); // Start the receiver
    
    }
    void loop() {
    
      // Buffer that holds the data received
      uint8_t buf[VW_MAX_MESSAGE_LEN];
      uint8_t buflen = VW_MAX_MESSAGE_LEN;
      // check to see if anything has been received
      if (vw_get_message(buf, &buflen)) {
    
        // Data trimming
        flex_signal1 = constrain(buf[0], F1MIN, F1MAX);
        flex_signal2 = constrain(buf[2], F2MIN, F2MAX);
        flex_signal3 = constrain(buf[4], F3MIN, F3MAX);
        flex_signal4 = constrain(buf[6], F4MIN, F4MAX);
        flex_signal5 = constrain(buf[8], F5MIN, F5MAX);
    
        // Maps the values from the flex resistor to control signals of the motor
        int controlFinger1 = map(flex_signal1, F1MIN, F1MAX, 180, 0);
        int controlFinger2 = map(flex_signal2, F2MIN, F2MAX, 180, 0);
        int controlFinger3 = map(flex_signal3, F3MIN, F3MAX, 180, 0);
        int controlFinger4 = map(flex_signal4, F4MIN, F4MAX, 180, 0);
        int controlFinger5 = map(flex_signal5, F5MIN, F5MAX, 180, 0);
        finger1.write(controlFinger1);
        finger2.write(controlFinger2);
        finger3.write(controlFinger3);
        finger4.write(controlFinger4);
        finger5.write(controlFinger5);
        //Monitor values through serial monitos
        Serial.print("flex1: ");
        Serial.print(flex_signal1);
        Serial.print("flex2: ");
        Serial.print(flex_signal2);
        Serial.print("flex3: ");
        Serial.print(flex_signal3);
        Serial.print("flex4: ");
        Serial.print(flex_signal4);
        Serial.print("flex5: ");
        Serial.print(flex_signal5);
        Serial.print(" motor1: ");
        Serial.print(controlFinger1);
        Serial.print(" motor2: ");
        Serial.print(controlFinger2);
        Serial.print(" motor3: ");
        Serial.print(controlFinger3);
        Serial.print(" motor4: ");
        Serial.print(controlFinger4);
        Serial.print(" motor5: ");
        Serial.print(controlFinger5);
      }
    
    }
    If you try to verify this any get the error "Error compiling for Arduino/Genuino exit status 1", the appearance of "for Arduino/Genuino" is a sure sign you have not selected Teensy 3.2 in the Tools > Boards menu!

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    8
    Mr. Paul, I cannot graciously thank you enough! You have been a huge help! Thank you kind sir!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •