As mentioned in another post, I’m working on a large rocket (1m30) and I need safe parachute electronic, so I’m using an accelerometer ADXL345 to detect the launch then wait and open the hatch. After that a light blinks in case I’ve to find it in the forest near the launch site…
I’m working on for 2 hours so good luck to find the problem(s).
First thing I would change though is move the line accel.setRange(ADXL345_RANGE_8_G); in the setup() after calling accel.begin()
And of course having while (1)[b][color=red];[/color][/b] {...} in the middle of your loop is a recipe for total failure… ( get rid of that stupid semi colon)
ok thanks I'll change that but here's what it say.
Bryce-18-2.3:9: error: 'accel' does not name a type
Bryce-18-2.3.ino: In function 'void loop()':
Bryce-18-2.3:54: error: 'class Adafruit_ADXL345_Unified' has no member named 'readAccel'
'accel' does not name a type
OK, so here it is it still say : ‘class Adafruit_ADXL345_Unified’ has no member named ‘readAccel’
and it don’t know at all what that mean and how to get rid of that…
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345);creates an instance of that Adafruit_ADXL345_Unified class and that class does not have any method called readAccel... not sure where you got that code but it does not apply to that library.
you should use a method that exists and you can find that in the examples:
/* Get a new sensor event */
sensors_event_t event;
accel.getEvent(&event);
x= event.acceleration.x;
y= event.acceleration.y;
z= event.acceleration.z;
/* Display the results (acceleration is measured in m/s^2) */
Serial.print("acceleration X: "); Serial.print(event.acceleration.x); Serial.print(" ");
Serial.print("acceleration Y: "); Serial.print(event.acceleration.y); Serial.print(" ");
Serial.print("acceleration Z: "); Serial.print(event.acceleration.z); Serial.println(" m/s^2 ");