mirror of https://github.com/noisymime/Arduino.git
Adding ADXL3xx accelerometer example; minor comment changes.
This commit is contained in:
parent
0bdc02cea5
commit
278872728a
|
@ -56,7 +56,7 @@
|
||||||
productName = App;
|
productName = App;
|
||||||
productReference = 33DD8FB6096AC8DA0013AF8F /* Arduino.app */;
|
productReference = 33DD8FB6096AC8DA0013AF8F /* Arduino.app */;
|
||||||
productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
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\">
|
<plist version=\"1.0\">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
@ -687,6 +687,7 @@
|
||||||
33FFFD3F0965B1E40016AC38 /* Project object */ = {
|
33FFFD3F0965B1E40016AC38 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
buildConfigurationList = 33FFFD400965B1E40016AC38 /* Build configuration list for PBXProject "Arduino" */;
|
buildConfigurationList = 33FFFD400965B1E40016AC38 /* Build configuration list for PBXProject "Arduino" */;
|
||||||
|
compatibilityVersion = "Xcode 2.4";
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
mainGroup = 33FFFD3D0965B1E40016AC38;
|
mainGroup = 33FFFD3D0965B1E40016AC38;
|
||||||
productRefGroup = 33FFFD3D0965B1E40016AC38;
|
productRefGroup = 33FFFD3D0965B1E40016AC38;
|
||||||
|
@ -879,13 +880,13 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
HEADER_SEARCH_PATHS = "";
|
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_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_SOURCE_VERSION = 1.4;
|
||||||
JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
|
JAVA_COMPILER_TARGET_VM_VERSION = 1.4;
|
||||||
JAVA_ONLY = YES;
|
JAVA_ONLY = YES;
|
||||||
JAVA_SOURCE_SUBDIR = .;
|
JAVA_SOURCE_SUBDIR = .;
|
||||||
OPTIMIZATION_CFLAGS = "-O0";
|
|
||||||
OTHER_CFLAGS = "";
|
OTHER_CFLAGS = "";
|
||||||
OTHER_LDFLAGS = "";
|
OTHER_LDFLAGS = "";
|
||||||
OTHER_REZFLAGS = "";
|
OTHER_REZFLAGS = "";
|
||||||
|
@ -912,7 +913,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
OPTIMIZATION_CFLAGS = "-O0";
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
OTHER_CFLAGS = "";
|
OTHER_CFLAGS = "";
|
||||||
OTHER_LDFLAGS = "";
|
OTHER_LDFLAGS = "";
|
||||||
OTHER_REZFLAGS = "";
|
OTHER_REZFLAGS = "";
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -42,6 +42,8 @@ unsigned long millis()
|
||||||
unsigned long m;
|
unsigned long m;
|
||||||
uint8_t oldSREG = SREG;
|
uint8_t oldSREG = SREG;
|
||||||
|
|
||||||
|
// disable interrupts while we read timer0_millis or we might get an
|
||||||
|
// inconsistent value (e.g. in the middle of the timer0_millis++)
|
||||||
cli();
|
cli();
|
||||||
m = timer0_millis;
|
m = timer0_millis;
|
||||||
SREG = oldSREG;
|
SREG = oldSREG;
|
||||||
|
@ -57,7 +59,7 @@ void delay(unsigned long ms)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delay for the given number of microseconds. Assumes a 16 MHz clock.
|
/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock.
|
||||||
* Disables interrupts, which will disrupt the millis() function if used
|
* Disables interrupts, which will disrupt the millis() function if used
|
||||||
* too frequently. */
|
* too frequently. */
|
||||||
void delayMicroseconds(unsigned int us)
|
void delayMicroseconds(unsigned int us)
|
||||||
|
|
6
todo.txt
6
todo.txt
|
@ -6,11 +6,11 @@ Add highByte(), lowByte(), and makeWord(high, low) functions.
|
||||||
Add bitRead() and bitWrite() functions (and bitSet() and bitClear()?)
|
Add bitRead() and bitWrite() functions (and bitSet() and bitClear()?)
|
||||||
Add Encoder library.
|
Add Encoder library.
|
||||||
Add String library.
|
Add String library.
|
||||||
Add Servo library.
|
|
||||||
Comment LiquidCrystal examples.
|
Comment LiquidCrystal examples.
|
||||||
Write LiquidCrystal documentation.
|
Write LiquidCrystal documentation.
|
||||||
[done] Move #include <WProgram.h> after other #include's? (prevent it from interfering with standard libraries)
|
[done] Move #include <WProgram.h> after other #include's? (prevent it from interfering with standard libraries)
|
||||||
[done] Add LiquidCrystal library.
|
[done] Add LiquidCrystal library.
|
||||||
|
[done] Add Servo library.
|
||||||
[done] Fix millis() so it overflows on a nice variable-size boundary; see: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205949448
|
[done] Fix millis() so it overflows on a nice variable-size boundary; see: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205949448
|
||||||
[done] Factor out print statements into a common base class for Serial, LiquidCrystal, etc.
|
[done] Factor out print statements into a common base class for Serial, LiquidCrystal, etc.
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ Supporting EEMEM directive by changing compiler command line: http://www.arduino
|
||||||
Include Arduino as AVR-ISP sketch in hardware/firmwares.
|
Include Arduino as AVR-ISP sketch in hardware/firmwares.
|
||||||
Move type definitions into WConstants.h.
|
Move type definitions into WConstants.h.
|
||||||
Change core to use Arduino types (e.g. byte, boolean).
|
Change core to use Arduino types (e.g. byte, boolean).
|
||||||
|
Fix millis() so it never increments by two.
|
||||||
|
Consider moving millis() to timer 1, and configuring it so the interrupt is generated once a millisecond.
|
||||||
|
|
||||||
COMPUTER
|
COMPUTER
|
||||||
|
|
||||||
|
@ -128,4 +130,4 @@ Show a picture of the LED flashing.
|
||||||
|
|
||||||
DOCUMENTATION / TROUBLESHOOTING
|
DOCUMENTATION / TROUBLESHOOTING
|
||||||
|
|
||||||
Add explanation of how to work around auto-reset.
|
Add explanation of how to work around auto-reset.
|
||||||
|
|
Loading…
Reference in New Issue