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

Thread: Error Compiling for board Teensy 3.2 / 3.1

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

    Error Compiling for board Teensy 3.2 / 3.1

    When trying to verify this code in Arduino I am getting the following error messages (this is not a duplicate):

    Code:
    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modified_sketch_323375\threeservos.ino:3:0:
    
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Servo/Servo.h:88: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_modified_sketch_323375\threeservos.ino:2:0:
    
    C:\Users\Kaylen\Documents\Arduino\libraries\ServoTimer2-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_modified_sketch_323375\threeservos.ino:3:0:
    
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Servo/Servo.h:89: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_modified_sketch_323375\threeservos.ino:2:0:
    
    C:\Users\Kaylen\Documents\Arduino\libraries\ServoTimer2-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_modified_sketch_323375\threeservos.ino:3:0:
    
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Servo/Servo.h:101:3: error: conflicting declaration 'typedef struct ServoPin_t ServoPin_t'
    
     } ServoPin_t   ;  
    
       ^
    
    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modified_sketch_323375\threeservos.ino:2:0:
    
    C:\Users\Kaylen\Documents\Arduino\libraries\ServoTimer2-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_modified_sketch_323375\threeservos.ino:3:0:
    
    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Servo/Servo.h:106:3: error: conflicting declaration 'typedef struct servo_t servo_t'
    
     } servo_t;
    
       ^
    
    In file included from C:\Users\Kaylen\AppData\Local\Temp\arduino_modified_sketch_323375\threeservos.ino:2:0:
    
    C:\Users\Kaylen\Documents\Arduino\libraries\ServoTimer2-master/ServoTimer2.h:107:4: note: previous declaration as 'typedef struct servo_t servo_t'
    
     }  servo_t;
    
        ^
    
    Multiple libraries were found for "VirtualWire.h"
     Used: C:\Users\Kaylen\Documents\Arduino\libraries\VirtualWire
     Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\VirtualWire
    Multiple libraries were found for "Servo.h"
     Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Servo
     Not used: C:\Program Files (x86)\Arduino\libraries\Servo
    Error compiling for board Teensy 3.2 / 3.1.
    The code is shown below

    Code:
    #include <VirtualWire.h>
    #include <ServoTimer2.h>
    #include <Servo.h>
    // Declare Sevor Objects
    ServoTimer2 string1;
    ServoTimer2 string2;
    ServoTimer2 string3;
    ServoTimer2 string4;
    ServoTimer2 string5;
    // Declare signal inputs
    int pressure_signal1;
    int pressure_signal2;
    int pressure_signal3;
    int pressure_signal4;
    int pressure_signal5;
    // Callibrated MIN MAX valuse for the flex resistors
    int P1MIN = 0;
    int P1MAX = 1000;
    int P2MIN = 0;
    int P2MAX = 1000;
    int P3MIN = 0;
    int P3MAX = 1000;
    int P4MIN = 0;
    int P4MAX = 1000;
    int P5MIN = 0;
    int P5MAX = 1000;
    //Setup
    void setup() {
      Serial.begin(9600);
      string1.attach(9);
      string2.attach(10);
      string3.attach(11);
      string4.attach(12);
      string5.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
        pressure_signal1 = constrain(buf[0], P1MIN, P1MAX);
        pressure_signal2 = constrain(buf[2], P2MIN, P2MAX);
        pressure_signal3 = constrain(buf[4], P3MIN, P3MAX);
        pressure_signal4 = constrain(buf[6], P4MIN, P4MAX);
        pressure_signal5 = constrain(buf[8], P5MIN, P5MAX);
        // Maps the values from the flex resistor to control signals of the motor
        int pullFinger1 = map(pressure_signal1, P1MIN, P1MAX, 0, 180);
        int pullFinger2 = map(pressure_signal2, P2MIN, P2MAX, 180, 0);
        int pullFinger3 = map(pressure_signal3, P3MIN, P3MAX, 0, 180);
        int pullFinger4 = map(pressure_signal4, P4MIN, P4MAX, 180, 0);
        int pullFinger5 = map(pressure_signal5, P5MIN, P5MAX, 0, 180);
    
    
        string1.write(pullFinger1);
        string2.write(pullFinger2);
        string3.write(pullFinger3);
        string4.write(pullFinger4);
        string5.write(pullFinger5);
        //Monitor values through serial monitos
        Serial.print("pressure1: ");
        Serial.print(pressure_signal1);
        Serial.print(" pressure2: ");
        Serial.print(pressure_signal2);
        Serial.print("pressure3: ");
        Serial.print(pressure_signal3);
        Serial.print(" pressure4: ");
        Serial.print(pressure_signal4);
        Serial.print("pressure5: ");
        Serial.print(pressure_signal5);
        Serial.print(" motor1: ");
        Serial.print(pullFinger1);
        Serial.print(" motor2: ");
        Serial.println(pullFinger2);
        Serial.print(" motor3: ");
        Serial.print(pullFinger3);
        Serial.print(" motor4: ");
        Serial.println(pullFinger4);
        Serial.print(" motor5: ");
        Serial.print(pullFinger5);
      }
    
    }
    Last edited by KurtE; 04-28-2019 at 01:58 PM. Reason: Code Tags

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,689
    Most of these error messages are hopefully pretty self explanatory. That is most of you are telling you that there are things (either #defines or class names) which have been defined multiple times and they are not compatible with each other.

    It appears to me, like you are including multiple libraries Servo and ServoTImer2 which define some of the same classes and other things like constants, which probably are not compatible with each other...

    So you probably have to figure out if you need/want both of them and if so, you will probably need to make your own copy of one of them, and maybe change the class names as to not have them be duplicates of each other, and then likewise change any impacted code, like places that use these objects...

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    8
    I am new to Arduino, is it possible to correct the code for me? Or to instruct me on how to fix the code.

  4. #4
    Junior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    16
    @kaylen - remove the #include <Servo.h> line and see if that resolves the issue

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,064
    Quote Originally Posted by kaylen View Post
    I am getting the following error messages (this is not a duplicate)
    It's nearly identical code to your other thread, where I and others answered.

    https://forum.pjrc.com/threads/55918...rduino-Genuino

    Why do you keep creating new threads with substantially the same code & question? This only annoys everyone who would do the most to help you. You are only hurting your own opportunity for help by doing this.


    Quote Originally Posted by kaylen View Post
    I am new to Arduino, is it possible to correct the code for me? Or to instruct me on how to fix the code.
    Did you use the corrected code I gave you on msg #4 of that thread, where you replied "I cannot graciously thank you enough! You have been a huge help!"

    I am not feeling like helping you further with the same code on this duplicate thread. Please, use the original thread.

    If you keep creating more threads with the same code, they will be closed and eventually you may even be banned from the forum. We do a lot to help here with code issues, but we do not like seeing so many duplicate threads for the same code and basically the same question (asking us to fix it for you - without even info about where you found this code or what it really does).

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,689
    @kaylen - While this is not exactly a duplicate, it looks like it is part of the same thing... So often times it is better to simply continue on the previous thread about this program.

    You will probably find it more likely that you will get a lot more help on issues, if it looks like you did your homework and provided sufficient information for people to help you.

    So far we know you have a Teensy 3.2 and from the error messages you are running Windows. Not sure which version of Arduino nor Teensyduino.

    We know you are including a few different libraries including Servo and ServoTimer2. Why both? Where did you get these libraries from? Hopefully Servo library is the one that Teensyduino installs.
    Where did ServoTimer2 come from? Why are using it versus just using Servo?

    But again fixing your issue? I can get it to compile by just changing the start of the program like:
    Code:
    #include <VirtualWire.h>
    #include <Servo.h>
    // Declare Sevor Objects
    Servo string1;
    Servo string2;
    Servo string3;
    Servo string4;
    Servo string5;
    ...
    But does that "Fix" your issue? Don't know...

Posting Permissions

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