1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Adding ADXL3xx accelerometer example; minor comment changes.

This commit is contained in:
David A. Mellis
2008-07-02 19:06:27 +00:00
parent 0bdc02cea5
commit 278872728a
4 changed files with 58 additions and 6 deletions

View File

@ -56,7 +56,7 @@
productName = App;
productReference = 33DD8FB6096AC8DA0013AF8F /* Arduino.app */;
productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleDevelopmentRegion</key>
@ -687,6 +687,7 @@
33FFFD3F0965B1E40016AC38 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 33FFFD400965B1E40016AC38 /* Build configuration list for PBXProject "Arduino" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 0;
mainGroup = 33FFFD3D0965B1E40016AC38;
productRefGroup = 33FFFD3D0965B1E40016AC38;
@ -879,13 +880,13 @@
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "";
GCC_OPTIMIZATION_LEVEL = 0;
HEADER_SEARCH_PATHS = "";
JAVA_CLASS_SEARCH_PATHS = "../shared/lib/registry.jar ../shared/lib/antlr.jar ../shared/lib/mrj.jar ../shared/lib/RXTXcomm.jar ../shared/lib/oro.jar";
JAVA_COMPILER_SOURCE_VERSION = 1.4;
JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
JAVA_ONLY = YES;
JAVA_SOURCE_SUBDIR = .;
OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
@ -912,7 +913,7 @@
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
OPTIMIZATION_CFLAGS = "-O0";
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";

View File

@ -0,0 +1,47 @@
// ADXL3xx
//
// Reads an Analog Devices ADXL3xx accelerometer and communicates the
// acceleration to the computer. The pins used are designed to be easily
// compatible with the breakout boards from Sparkfun, available from:
// http://www.sparkfun.com/commerce/categories.php?c=80
//
// http://www.arduino.cc/en/Tutorial/ADXL3xx
// Breakout Board Pinout
// 0: self test
// 1: z-axis
// 2: y-axis
// 3: x-axis
// 4: ground
// 5: vcc
int groundpin = 18; // analog input pin 4
int powerpin = 19; // analog input pin 5
int xpin = 3; // x-axis of the accelerometer
int ypin = 2; // y-axis
int zpin = 1; // z-axis (only on 3-axis models)
void setup()
{
Serial.begin(9600);
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
}
void loop()
{
Serial.print(analogRead(xpin));
Serial.print(" ");
Serial.print(analogRead(ypin));
Serial.print(" ");
Serial.print(analogRead(zpin));
Serial.println();
delay(1000);
}