mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,24 +1,24 @@
|
||||
/*
|
||||
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 Aug 2011
|
||||
by Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
*/
|
||||
@ -41,13 +41,13 @@ void loop() {
|
||||
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);
|
||||
|
||||
pulseX = pulseIn(xPin, HIGH);
|
||||
pulseY = pulseIn(yPin, HIGH);
|
||||
|
||||
// convert the pulse width into acceleration
|
||||
// accelerationX and accelerationY are in milli-g's:
|
||||
// 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;
|
||||
|
Reference in New Issue
Block a user