When trying to verify this code in Arduino I am getting the following error messages (this is not a duplicate):
The code is shown below
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 a moderator: