diff --git a/build/macosx/Arduino.xcodeproj/project.pbxproj b/build/macosx/Arduino.xcodeproj/project.pbxproj index 2c8016846..1df5bb2c8 100644 --- a/build/macosx/Arduino.xcodeproj/project.pbxproj +++ b/build/macosx/Arduino.xcodeproj/project.pbxproj @@ -56,7 +56,7 @@ productName = App; productReference = 33DD8FB6096AC8DA0013AF8F /* Arduino.app */; productSettingsXML = " - + CFBundleDevelopmentRegion @@ -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 = ""; diff --git a/build/shared/dist/examples/Analog/ADXL3xx/ADXL3xx.pde b/build/shared/dist/examples/Analog/ADXL3xx/ADXL3xx.pde new file mode 100644 index 000000000..41fc69ed2 --- /dev/null +++ b/build/shared/dist/examples/Analog/ADXL3xx/ADXL3xx.pde @@ -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); +} diff --git a/hardware/cores/arduino/wiring.c b/hardware/cores/arduino/wiring.c index 8459229f2..31e024719 100755 --- a/hardware/cores/arduino/wiring.c +++ b/hardware/cores/arduino/wiring.c @@ -42,6 +42,8 @@ unsigned long millis() unsigned long m; 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(); m = timer0_millis; 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 * too frequently. */ void delayMicroseconds(unsigned int us) diff --git a/todo.txt b/todo.txt index baa8bb5fb..4931fc16e 100644 --- a/todo.txt +++ b/todo.txt @@ -6,11 +6,11 @@ Add highByte(), lowByte(), and makeWord(high, low) functions. Add bitRead() and bitWrite() functions (and bitSet() and bitClear()?) Add Encoder library. Add String library. -Add Servo library. Comment LiquidCrystal examples. Write LiquidCrystal documentation. [done] Move #include after other #include's? (prevent it from interfering with standard libraries) [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] 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. Move type definitions into WConstants.h. 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 @@ -128,4 +130,4 @@ Show a picture of the LED flashing. DOCUMENTATION / TROUBLESHOOTING -Add explanation of how to work around auto-reset. \ No newline at end of file +Add explanation of how to work around auto-reset.