Is there A way to take the two programs and put them as one.
The first code is the one that give's me data on the mma7660 3 axis accelerometer. What I don't know how to
do is get more sensitivity out of the (mma7660 3 axis accelerometer). Angles and Degree's can't read the dryer when it is
on and running. I need to read the shaking, little movement and sensitivity of the dryer. This is what the
(mma7660 3 axis accelerometer) should read as data.
#include <Wire.h>
#include <MMA7660.h>
void setup()
{
Serial.begin(9600);
MMA7660.init();
}
void loop()
{
int x,y,z;
delay(100); // There will be new values every 100ms
MMA7660.getValues(&x,&y,&z);
Serial.print("x: ");
Serial.print(x);
Serial.print(" y: ");
Serial.print(y);
Serial.print(" z: ");
Serial.println(z);
}static int old_x, old_y, old_z;
int new_x, new_y, new_z;
int delta_x, delta_y, delta_z;
double g;
new_x = analogRead(xPin);
new_y = analogRead(yPin);
new_z = analogRead(zPin);
delta_x = new_x - old_x;
delta_y = new_y - old_y;
delta_z = new_z - old_z;
g = sqrt ( sq(delta_x) + sq(delta_y) + sq(delta_x) );
g /= SENSITIVITY_VALUE; // convert to real 'g' according to sensor sensitivity;
old_x = new_x; // remember the value for the next sample
old_y = new_y;
old_z = new_z;
delay (60L * 1000L); // wait 1 minute