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

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 am getting the following error messages:

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:3:0:

    C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:80:0: warning: "MIN_PULSE_WIDTH" redefined

    #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:1:0:

    C:\Users\Kaylen\Documents\Arduino\libraries\ServoT imer2-master/ServoTimer2.h:79:0: note: this is the location of the previous definition

    #define MIN_PULSE_WIDTH 750 // the shortest pulse sent to a servo

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:3:0:

    C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:81:0: warning: "MAX_PULSE_WIDTH" redefined

    #define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:1:0:

    C:\Users\Kaylen\Documents\Arduino\libraries\ServoT imer2-master/ServoTimer2.h:81:0: note: this is the location of the previous definition

    #define MAX_PULSE_WIDTH 2250 // the longest pulse sent to a servo

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:3:0:

    C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:95:3: error: conflicting declaration 'typedef struct ServoPin_t ServoPin_t'

    } ServoPin_t ;

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:1:0:

    C:\Users\Kaylen\Documents\Arduino\libraries\ServoT imer2-master/ServoTimer2.h:95:6: note: previous declaration as 'typedef struct ServoPin_t ServoPin_t'

    } ServoPin_t ;

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:3:0:

    C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:100:3: error: conflicting declaration 'typedef struct servo_t servo_t'

    } servo_t;

    ^

    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modifie d_sketch_411269\threeservos.ino:1:0:

    C:\Users\Kaylen\Documents\Arduino\libraries\ServoT imer2-master/ServoTimer2.h:107:4: note: previous declaration as 'typedef struct servo_t servo_t'

    } servo_t;

    ^

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    The code is shown below

    #include <ServoTimer2.h> // the servo library
    #include <VirtualWire.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;


    #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
    #define MAX_PULSE_WIDTH 2050 // the longest pulse sent to a servo

    // Callibrated MIN MAX valuse for the flex resistors
    int F1MIN=545;
    int F1MAX=635;
    int F2MIN=600;
    int F2MAX=775;
    int F3MIN=750;
    int F3MAX=875;
    int F4MIN=825;
    int F4MAX=945;
    int F5MIN=915;
    int F5MAX=1000;

    //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
    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);
    }

    }

  2. #2
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    332
    Another duplicate! Please do not post duplicate copies of your question. We do notice! Duplicates only annoy the people who are most likely to help you.

    The answer is on this other thread:
    https://forum.pjrc.com/threads/55918...rduino-Genuino

Posting Permissions

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