Will attempt to understand you welcome comment. But again I know nothing about this coding.
Enclosed is the entire code to see if this helps.
Thank You
Jerome
/*
*/
#include <Servo.h>
#include <SparkFun_ADXL345.h>
// Create servo objects for x and y servos
Servo xServo;
// Used to level the platform, if needed
int xOffset = -7;
// int sensitivity = 50; ORIGIONAL CODE, Changed to below. Works better.
int sensitivity = 0;
// Assign a unique ID to this sensor at the same time
SparkFun_ADXL345_Unified accel = SparkFun_ADXL345_Unified(12345); // THIS IS THE ERROR LINE
void setup() {
Serial.begin(9600);
// Initialize sensor
if(!accel.begin())
{
// Sensor not detected
Serial.println(“No Sensor detected”);
while(1);
}
// Connect servos to pins
xServo.attach(9);
// Setup sensor Range and datarate
accel.setRange(ADXL345_RANGE_16_G);
accel.setDataRate(ADXL345_DATARATE_25_HZ);
}
void loop() {
sensors_event_t event;
accel.getEvent(&event);
// Get x and y values from sensor
int x = event.acceleration.x;
// map sensor value (-10 - 10) to servo position value (30 - 150)
int x1 = map(x, -10, 10, 130, 50);
// Troubleshoot info - show sensor reading and mapping
Serial.print("X: "); Serial.print(x);
Serial.print("\tX1: "); Serial.print(x1);
// move servos based on sensor mapping
xServo.write(x1 + xOffset);
delay(sensitivity); //delay to decrease sensitivity
}