Hide minor edits - Show changes to markup
El Memsic 2125 (datasheet) es un acelerómetro de dos ejes capaz de medir la aceleración hasta más / menos 2g. Posee una simple conexión digital: dos pines (uno para cada eje) emiten pulsos cuyo ciclo de trabajo (Duty cycle) corresponde con la aceleración de cada eje.
The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
El Memsic 2125 (datasheet) es un acelerómetro de dos ejes capaz de medir la aceleración hasta más/menos 2g. Posee una simple conexión digital: dos pines (uno para cada eje) emiten pulsos cuya duración corresponde con la aceleración de cada eje.
Schematic:
click the image to enlarge
Esquemático
Pincha en la imágen para verla en grande
The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.
Los pines de 5V y GND (Tierra) de Arduino están conectados a los pines 5V y GND del Memsic 2125; el pin digital 2 de Arduino está conectado al pin de salida X del Memsic 2125 y el pin digital 3 está conectado al pin de salida Y.
El Memsic 2125 (datasheet) es un acelerómetro de dos ejes capaz de medir la aceleración hasta más / menos 2g. Posee una simple conexión digital: dos pines (uno para cada eje) emiten pulsos cuyo ciclo de trabajo (Duty cycle) corresponde con la aceleración de cada eje.
/* Memsic2125 Read the Memsic 2125 two-axis accelerometer. Converts the pulses output by the 2125 into milli-g's (1/1000 of earth's gravity) and prints them over the serial connection to the computer. The circuit: * X output of accelerometer to digital pin 2 * Y output of accelerometer to digital pin 3 * +V of accelerometer to +5V * GND of accelerometer to ground http://www.arduino.cc/en/Tutorial/Memsic2125 created 6 Nov 2008 by David A. Mellis modified 30 Jun 2009 by Tom Igoe
(:includeurl http://arduino.googlecode.com/svn/trunk/build/shared/examples/Sensors/Memsic2125/Memsic2125.pde border=0:)
*/
// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer
void setup() { // initialize serial communications: Serial.begin(9600); // initialize the pins connected to the accelerometer // as inputs: pinMode(xPin, INPUT); pinMode(yPin, INPUT); }
void loop() { // variables to read the pulse widths: int pulseX, pulseY; // variables to contain the resulting accelerations int accelerationX, accelerationY;
// read pulse from x- and y-axes: pulseX = pulseIn(xPin,HIGH); pulseY = pulseIn(yPin,HIGH);
// convert the pulse width into acceleration // accelerationX and accelerationY are in milli-g's: // earth's gravity is 1000 milli-g's, or 1g. accelerationX = ((pulseX / 10) - 500) * 8; accelerationY = ((pulseY / 10) - 500) * 8;
// print the acceleration Serial.print(accelerationX); // print a tab character: Serial.print("\t"); Serial.print(accelerationY); Serial.println();
delay(100);
}
(:divend:)
(:divend:)
[@ /*
Memsic2125
Read the Memsic 2125 two-axis accelerometer. Converts the pulses output by the 2125 into milli-g's (1/1000 of earth's gravity) and prints them over the serial connection to the computer.
The circuit: * X output of accelerometer to digital pin 2 * Y output of accelerometer to digital pin 3 * +V of accelerometer to +5V * GND of accelerometer to ground
(:div class=code :)
http://www.arduino.cc/en/Tutorial/Memsic2125
/* Memsic2125 Read the Memsic 2125 two-axis accelerometer. Converts the pulses output by the 2125 into milli-g's (1/1000 of earth's gravity) and prints them over the serial connection to the computer. The circuit: * X output of accelerometer to digital pin 2 * Y output of accelerometer to digital pin 3 * +V of accelerometer to +5V * GND of accelerometer to ground http://www.arduino.cc/en/Tutorial/Memsic2125 created 6 Nov 2008 by David A. Mellis modified 30 Jun 2009 by Tom Igoe
*/
// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer
void setup() { // initialize serial communications: Serial.begin(9600); // initialize the pins connected to the accelerometer // as inputs: pinMode(xPin, INPUT); pinMode(yPin, INPUT); }
void loop() { // variables to read the pulse widths: int pulseX, pulseY; // variables to contain the resulting accelerations int accelerationX, accelerationY;
created 6 Nov 2008 by David A. Mellis modified 30 Jun 2009 by Tom Igoe
*/
// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer
void setup() {
// initialize serial communications: Serial.begin(9600); // initialize the pins connected to the accelerometer // as inputs: pinMode(xPin, INPUT); pinMode(yPin, INPUT);
}
void loop() {
// variables to read the pulse widths: int pulseX, pulseY; // variables to contain the resulting accelerations int accelerationX, accelerationY;
// read pulse from x- and y-axes: pulseX = pulseIn(xPin,HIGH); pulseY = pulseIn(yPin,HIGH);
// convert the pulse width into acceleration // accelerationX and accelerationY are in milli-g's: // earth's gravity is 1000 milli-g's, or 1g. accelerationX = ((pulseX / 10) - 500) * 8; accelerationY = ((pulseY / 10) - 500) * 8;
// print the acceleration
Serial.print(accelerationX);
// print a tab character:
Serial.print("\t");
Serial.print(accelerationY);
Serial.println();
delay(100);
} @]
// read pulse from x- and y-axes: pulseX = pulseIn(xPin,HIGH); pulseY = pulseIn(yPin,HIGH);
// convert the pulse width into acceleration // accelerationX and accelerationY are in milli-g's: // earth's gravity is 1000 milli-g's, or 1g. accelerationX = ((pulseX / 10) - 500) * 8; accelerationY = ((pulseY / 10) - 500) * 8;
// print the acceleration Serial.print(accelerationX); // print a tab character: Serial.print("\t"); Serial.print(accelerationY); Serial.println();
delay(100);
}
(:divend:)
int xpin = 2; int ypin = 3;
void setup() {
Serial.begin(9600); pinMode(xpin, INPUT); pinMode(ypin, INPUT);
}
void loop() {
int pulseX, pulseY; int accX, accY;
/*
Memsic2125
Read the Memsic 2125 two-axis accelerometer. Converts the pulses output by the 2125 into milli-g's (1/1000 of earth's gravity) and prints them over the serial connection to the computer.
The circuit: * X output of accelerometer to digital pin 2 * Y output of accelerometer to digital pin 3 * +V of accelerometer to +5V * GND of accelerometer to ground
// read pulse from x- and y-axes pulseX = pulseIn(xpin,HIGH); pulseY = pulseIn(ypin,HIGH);
http://www.arduino.cc/en/Tutorial/Memsic2125
created 6 Nov 2008 by David A. Mellis modified 30 Jun 2009 by Tom Igoe
*/
// these constants won't change: const int xPin = 2; // X output of the accelerometer const int yPin = 3; // Y output of the accelerometer
void setup() {
// initialize serial communications: Serial.begin(9600); // initialize the pins connected to the accelerometer // as inputs: pinMode(xPin, INPUT); pinMode(yPin, INPUT);
}
void loop() {
// variables to read the pulse widths: int pulseX, pulseY; // variables to contain the resulting accelerations int accelerationX, accelerationY;
// read pulse from x- and y-axes: pulseX = pulseIn(xPin,HIGH); pulseY = pulseIn(yPin,HIGH);
// accX and accY are in milli-g's: earth's gravity is 1000. accX = ((pulseX / 10) - 500) * 8; accY = ((pulseY / 10) - 500) * 8;
// accelerationX and accelerationY are in milli-g's: // earth's gravity is 1000 milli-g's, or 1g. accelerationX = ((pulseX / 10) - 500) * 8; accelerationY = ((pulseY / 10) - 500) * 8;
Serial.print(accX);
Serial.print(" ");
Serial.print(accY);
Serial.print(accelerationX);
// print a tab character:
Serial.print("\t");
Serial.print(accelerationY);
The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring acceleration up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
The Memsic 2125 is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
The Memsic 2125 (datasheet) is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
The 5V pin and GND pins on the Arduino are connected to the 5V and GND pins of the Memsic 2125; digital pin 2 of the Arduino is connected to the X out pin of the Memsic, and digital pin 3 is connected to the Y out pin.
int xpin = 2;
int ypin = 3;
void setup()
{
Serial.begin(9600);
pinMode(xpin, INPUT);
pinMode(ypin, INPUT);
}
void loop()
{
int pulseX, pulseY;
int accX, accY;
// read pulse from x- and y-axes
pulseX = pulseIn(xpin,HIGH);
pulseY = pulseIn(ypin,HIGH);
// convert the pulse width into acceleration
// accX and accY are in milli-g's: earth's gravity is 1000.
accX = ((pulseX / 10) - 500) * 8;
accY = ((pulseY / 10) - 500) * 8;
// print the acceleration
Serial.print(accX);
Serial.print(" ");
Serial.print(accY);
Serial.println();
delay(100);
}
The Memsic 2125 is a two-axis accelerometer capable of measuring up to plus or minus 2g. It has a simple digital interface: two pins (one for each axis) emit pulses whose duration corresponds to the acceleration of that axis.
