Show Posts
Pages: 1 ... 382 383 [384] 385 386 ... 581
5746  Using Arduino / Sensors / Re: How to read register value from ADXL345 Eval board? on: March 19, 2012, 07:34:52 am
In readFrom() you have an extra Wire.beginTransmission().
5747  Using Arduino / Programming Questions / Re: EEPROM on the ATMega328P on: March 19, 2012, 07:27:14 am
Unlike the Flash memory (used for your compiled binary) you can write to the EEPROM from your application.  And unlike the RAM it will stay set when the power is off.
5748  Using Arduino / Installation & Troubleshooting / Re: Power Problems? on: March 19, 2012, 07:18:45 am
Does this mean I need a new regulator? or is there something else which could have died?

From the schematic it looks like the 5V regulator is the most likely failure point. It's the only active component between Vin and +5 and it isn't used for USB power:

http://arduino.cc/en/uploads/Main/arduino-duemilanove-schematic.pdf

It should not be as hard to replace as most surface-mount components.
5749  Using Arduino / Programming Questions / Re: On startup, start loop at beginning of next minute on: March 18, 2012, 08:39:07 pm
Perhaps if you could provide the code you have now, the rest of the solution might present itself.
5750  Using Arduino / Installation & Troubleshooting / Re: i have a problem connecting skm53 to arduino mega on: March 18, 2012, 06:12:19 pm
Are you using Arduino 1.0?  If so, try replacing "NewSoftSerial" with "SoftwareSerial".  Pins 2 and 3 should work on the Mega just as well as the UNO.  If that fails I would reduce the serial data rate for 115200 to 9600 to reduce the chance that the serial communications to Serial Monitor is having trouble.
5751  Using Arduino / Programming Questions / Re: Receiving 2 bytes through serial from processing, first refreshes much faster. on: March 18, 2012, 06:01:49 pm
You wrote:
Code:
  if (Serial.available() >=2)
  {
    for (int i=0; i<2; i++)
    {
      pass[i]=Serial.read();
      analogWrite(ledPinX, pass[1]);
      analogWrite(ledPinY, pass[2]);
    }
  }

You probably meant:
Code:
  if (Serial.available() >=2)
  {
    for (int i=0; i<2; i++)
    {
      pass[i]=Serial.read();
    }
    analogWrite(ledPinX, pass[1]);
    analogWrite(ledPinY, pass[2]);
  }
5752  Using Arduino / Programming Questions / Re: teensy to arduino on: March 18, 2012, 05:44:47 pm
The Teensy 2.0 uses an ATmega32U4 processor that has a built-in USB interface.   If you have an Arduino based on that chip or on a very similar chip you should be able to port the teensy libraries fairly easily.  For example: http://www.adafruit.com/products/296
5753  Using Arduino / Project Guidance / Re: asynchronous inputs & loops on: March 18, 2012, 05:34:36 pm
It's not clear what you mean by "asynchronous inputs and loops".   Did you want multiple execution threads?  It's not generally done because the RAM/Stack space is so limited.

The problem you are trying to solve might be solvable with multiple state machines.

Serial.read() is non-blocking (return -1 if no character is ready to read).
5754  Using Arduino / Programming Questions / Re: Question about the usage of F() on: March 18, 2012, 05:24:42 pm
> And I don't need the PROGMEM keyword for any of that?

The PROGMEM keyword is in the F() macro and in the Print object.

And on the function example, if I want it to be able to work with either RAM or flash, I could just use an overload one with char* and one with __FlashStringHelper?

Yes, I think that will work.
5755  Using Arduino / Microcontrollers / Re: ATTiny + PROGMEM on: March 18, 2012, 04:06:16 pm
> Is there a difference between reading from RAM and reading from Flash?

Yes.  They exist in different address spaces.  You have to use special functions to get bytes out of Flash/PROGMEM:

http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html
5756  Using Arduino / Programming Questions / Re: my first binary clock not working on: March 18, 2012, 03:48:19 pm
If for some reason the time setting buttons are reading LOW, the minutes and hours will increment about twice a second (total of 500 mSec of delays).  Make sure you have a pull-up resistor on the input pins.

Code:
  valm = digitalRead(19);    // add one minute when pressed
  if(valm== LOW) {
    minute++;
    second=0;
    delay(250);
  }
  valh = digitalRead(14);    // add one hour when pressed
  if(valh== LOW) {
    hour++;
    second=0;
    delay(250);
  }
5757  Using Arduino / Programming Questions / Re: my first binary clock not working on: March 18, 2012, 03:42:14 pm
You can simplify the display code a little more:

Code:
        // --- minutes ones

        digitalWrite( 1, (minute%10)  & 0b00000001); // 1's
        digitalWrite( 2, (minute%10)  & 0b00000010); // 2's
        digitalWrite( 3, (minute%10)  & 0b00000100); // 4's
        digitalWrite( 4, (minute%10)  & 0b00001000); // 8's

        // --- minutes tens

        digitalWrite( 5, (minute/10) & 0b00000001); // 1's
        digitalWrite( 6, (minute/10) & 0b00000010); // 2's
        digitalWrite( 7, (minute/10) & 0b00000100); // 4's


        // --- hours ones

        digitalWrite( 8, (hour%10) & 0b00000001); // 1's
        digitalWrite( 9, (hour%10) & 0b00000010)); // 2's
        digitalWrite(10, (hour%10) & 0b00000100); // 4's
        digitalWrite(11, (hour%10) & 0b00001000); // 8's

        // --- hours tens

        digitalWrite(12, (hour/10)   & 0b00000001); // 1's
        digitalWrite(13, (hour/10)   & 0b00000010); // 2's

Other suggestions to the code if you don't mind them at this stage of your project.
[/quote]
5758  Using Arduino / LEDs and Multiplexing / Re: Multiplexed 7-segments. Can this code be faster? on: March 18, 2012, 03:17:44 pm
To get more brightness, spend more time with the LEDs on:

Code:
const unsigned long delayWhileLit = 1;  // Increase this until you get flickering, then reduce a step

void writeMinutes(){
  PORTD = segBytes[minLeft]; // display left digit
  digitalWrite(leftMinAnode, ON);
  delay(delayWhileLit);
  digitalWrite(leftMinAnode, OFF);
  PORTD = segBytes[minRight]; // display right digit
  digitalWrite(rightMinAnode, ON);
  delay(delayWhileLit);
  digitalWrite(leftMinAnode, OFF);
}

void writeSeconds(){
  PORTD = segBytes[secLeft]; // display left digit
  digitalWrite(leftSecAnode, ON);
  delay(delayWhileLit);
  digitalWrite(leftSecAnode, OFF);
  PORTD = segBytes[secRight]; // display right digit
  digitalWrite(rightSecAnode, ON);
  delay(delayWhileLit);
  digitalWrite(rightSecAnode, OFF);
}
5759  Using Arduino / Programming Questions / Re: Stopwatch for calculating time between functions on: March 18, 2012, 03:09:17 pm
Variables that store the output of millis() should be 'unsigned long'.

If the time interval is measuring as 0 milliseconds you might want to try measuring in microseconds (micros()) instead.  The Arduino can execute about 16000 instructions per milliseconds (16 per microsecond) so it is possible a millisecond timer is too crude to detect the time.
5760  Using Arduino / Programming Questions / Re: Can't figure out why certain output pins are HIGH on: March 18, 2012, 02:26:08 pm
You can't use pins 0 and 1 for digital I/O when you are also using them for serial I/O (Serial.begin(9600)).

You can't use Pin 11 for digital I/O when you are using 11, 12, and 13 for the hardware SPI interface to your SD card.  Check the documentation for whatever hardware you have attached to see what pins they use.  That might explain Pin 6 as well.
Pages: 1 ... 382 383 [384] 385 386 ... 581